Sends a message. The session should be in the Connected state.

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

Syntax

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

MessageType, _
	
contentType 
As 
ContentType, _
	
body 
As 
Byte(), _
	
userCallback 
As 
AsyncCallback, _
	
state 
As 
Object _
) 
As 
IAsyncResult
C#
public 
IAsyncResult 
BeginSendMessage(
	
MessageType

messageType,
	
ContentType 
contentType,
	
byte[] 
body,
	
AsyncCallback 
userCallback,
	
Object 
state
)
Visual C++
public:
IAsyncResult^ 
BeginSendMessage(
	
MessageType

messageType, 
	
ContentType^ 
contentType, 
	
array<
unsigned char>^ 
body, 
	
AsyncCallback^ 
userCallback, 
	
Object^ 
state
)
JavaScript
function 
beginSendMessage(
messageType, 
contentType, 
body, 
userCallback, 
state);

Parameters

messageType
Type: Microsoft.Rtc.Signaling . . :: . MessageType
The type of the message 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.
userCallback
Type: AsyncCallback
The method to be called when the asynchronous operation is completed.
state
Type: Object
A user-provided object that distinguishes this particular asynchronous operation from other asynchronous operations.

Return Value

An IAsyncResult that references the asynchronous operation.

Exceptions

Exception Condition
InvalidOperationException Thrown when the session is in an invalid state to send the message.
ArgumentException Thrown when invalid arguments are passed.
ArgumentNullException Thrown when arguments are null.
Microsoft.Rtc.Signaling . . :: . ServerPolicyException A server policy setting does not allow the sending of the message.

See Also