Synchronously sends a message. The session should be in the Connected state. This method is not recommended for a UI thread.

Namespace:  Microsoft.Rtc.Signaling
Assembly:  Microsoft.Rtc.Collaboration(in Microsoft.Rtc.Collaboration.dll)

Syntax

Visual Basic (Declaration)
Public 
Function 
SendMessage ( _
	
messageType 
As 

MessageType, _
	
contentType 
As 
ContentType, _
	
body 
As 
Byte(), _
	
signalingHeaders 
As 
IEnumerable(
Of 

SignalingHeader) _
) 
As 

SipResponseData
C#
public 

SipResponseData 
SendMessage(
	
MessageType

messageType,
	
ContentType 
contentType,
	
byte[] 
body,
	
IEnumerable<

SignalingHeader> 
signalingHeaders
)
Visual C++
public:

SipResponseData^ 
SendMessage(
	
MessageType

messageType, 
	
ContentType^ 
contentType, 
	
array<
unsigned char>^ 
body, 
	
IEnumerable<

SignalingHeader^>^ 
signalingHeaders
)
JavaScript
function 
sendMessage(
messageType, 
contentType, 
body, 
signalingHeaders);

Parameters

messageType
Type: Microsoft.Rtc.Signaling . . :: . MessageType
The type of the body (message or info).
contentType
Type: ContentType
the content type describing the body. Can be null if body is null and if null text/plain, UTF-8 is assumed.
body
Type: array< Byte > [] () []
the body for the data.
signalingHeaders
Type: IEnumerable < (Of < ( SignalingHeader > ) > )
A collection of headers provided for this invite.

Return Value

Returns the response data.

Exceptions

Exception Condition
InvalidOperationException Thrown when the session is in an invalid state to send a message.
ArgumentException Thrown when invalid arguments are passed.
ArgumentNullException Thrown when a non-null is expected for an argument. The argument name for which a non-null is expected is part of the exception message.
Microsoft.Rtc.Signaling . . :: . FailureResponseException Thrown when the server or remote participant returns an error. The SipResponseData in the exception should give additional information.
Microsoft.Rtc.Signaling . . :: . RealTimeException Thrown when some other unknown errors occur.
Microsoft.Rtc.Signaling . . :: . ServerPolicyException A server policy setting does not allow the sending of the message.

See Also