SendResponse Method (Int32, ContentType, String, IEnumerable(SignalingHeader))
Sends a response to the message unless DisableAutomaticResponse is true.
Namespace: Microsoft.Rtc.Signaling
Assembly: Microsoft.Rtc.Collaboration (in Microsoft.Rtc.Collaboration.dll)
Syntax
'Declaration
Public MustOverride Sub SendResponse ( _
responseCode As Integer, _
contentType As ContentType, _
msgBody As String, _
signalingHeaders As IEnumerable(Of SignalingHeader) _
)
'Usage
Dim instance As MessageReceivedEventArgs
Dim responseCode As Integer
Dim contentType As ContentType
Dim msgBody As String
Dim signalingHeaders As IEnumerable(Of SignalingHeader)
instance.SendResponse(responseCode, contentType, _
msgBody, signalingHeaders)
public abstract void SendResponse(
int responseCode,
ContentType contentType,
string msgBody,
IEnumerable<SignalingHeader> signalingHeaders
)
Parameters
- responseCode
Type: System..::..Int32
The response code to be sent.
- contentType
Type: System.Net.Mime..::..ContentType
The content type of the response body.
- msgBody
Type: System..::..String
The body of the message.
- signalingHeaders
Type: System.Collections.Generic..::..IEnumerable<(Of <(<'SignalingHeader>)>)>
Headers required for this message.
Exceptions
Exception | Condition |
---|---|
RealTimeException | Thrown when a transport error occurred while sending a response. |
InvalidOperationException | Thrown when in an invalid state or when a response has already been sent. |
Remarks
This method is optional for message received events. If the application does not call [SendResponse] in [MessageReceived] handlers, the platform automatically responds with [ResponseCode.Succeeded].
The application is responsible for ensuring that required headers for the specific response code are added using this overloaded SendResponse method. For example, sending response code 405 requires the Allow header to be added.
See Also
Reference
MessageReceivedEventArgs Class