SmartFoxServer Silverlight API
SendXtMessage Method (xtName, cmd, paramObj, type, roomId)
Namespaces ► SmartFoxClientAPI ► SmartFoxClient ► SendXtMessage(String, String, ICollection<(Of <(Object>)>), String, Int32)
Send a request to a server side extension.
The request can be serialized using three different protocols: XML, JSON and string-based (aka "raw protocol").
XML and JSON can both serialize complex objects with any level of nested properties, while the string protocol allows to send linear data delimited by a separator (see the GetRawProtocolSeparator()()() property).
Declaration Syntax

C# | Visual Basic | Visual C++

    public void SendXtMessage(
    	string xtName,
    	string cmd,
    	ICollection<Object> paramObj,
    	string type,
    	int roomId
    )

    Public Sub SendXtMessage ( _
    	xtName As String, _
    	cmd As String, _
    	paramObj As ICollection(Of Object), _
    	type As String, _
    	roomId As Integer _
    )

    public:
    void SendXtMessage(
    	String^ xtName,
    	String^ cmd,
    	ICollection<Object^>^ paramObj,
    	String^ type,
    	int roomId
    )

Parameters

xtName (String)
  the name of the extension (see also the CreateRoom(NewRoomDescriptor, Int32) method).

cmd (String)
  the name of the action/command to execute in the extension.

paramObj (ICollection<(Of <(Object>)>))
  an object (Dictionary for XML and JSON, List for string) containing the data to be passed to the extension (set to empty object if no data is required).

type (String)
  the protocol to be used for serialization (optional). The following constants can be passed: XTMSG_TYPE_XML, XTMSG_TYPE_STR, XTMSG_TYPE_JSON.

roomId (Int32)
  the id of the room where the request was originated, in case of multi-room join (optional, default value: activeRoomId).

Remarks

Sends:
SFSEvent..::.OnExtensionResponseDelegate

Version:
SmartFoxServer Pro

Examples
The following example shows how to notify a multiplayer game server-side extension that a game action occurred.
CopyC#

              // A bullet is being fired
    Dictionary<object, object> bulletInfo = new Dictionary<object, object>();
    bulletInfo["type"] = "bullet";
    bulletInfo["posx"] = 100;
    bulletInfo["posy"] = 200;
    bulletInfo["speed"] = 10;
    bulletInfo["angle"] = 45;

              // Invoke "fire" command on the extension called "gameExt", using JSON protocol
              smartFox.SendXtMessage("gameExt", "fire", bulletInfo, SmartFoxClient.XTMSG_TYPE_JSON);

See Also
GetRawProtocolSeparator()()()
XTMSG_TYPE_XML
XTMSG_TYPE_JSON
XTMSG_TYPE_STR
SFSEvent..::.OnExtensionResponseDelegate

Assembly: SmartFoxClientAPI_Silverlight (Module: SmartFoxClientAPI_Silverlight) Version: 1.0.0.0 (1.0.0.0)