SmartFoxServer Unity/.NET API
SendXtMessage Method (xtName, cmd, paramObj, type, roomId)
NamespacesSmartFoxClientAPISmartFoxClientSendXtMessage(String, String, ICollection, 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 BasicVisual C++
public void SendXtMessage(
	string xtName,
	string cmd,
	ICollection paramObj,
	string type,
	int roomId
)
Public Sub SendXtMessage ( _
	xtName As String, _
	cmd As String, _
	paramObj As ICollection, _
	type As String, _
	roomId As Integer _
)
public:
void SendXtMessage(
	String^ xtName, 
	String^ cmd, 
	ICollection^ paramObj, 
	String^ type, 
	int roomId
)
Parameters
xtName (String)
the name of the extension (see also the CreateRoom(Hashtable, Int32) method).
cmd (String)
the name of the action/command to execute in the extension.
paramObj (ICollection)
an object (Hashtable for XML and JSON, ArrayList 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
Hashtable bulletInfo = new Hashtable();
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

Assembly: SmartFoxClient (Module: SmartFoxClient) Version: 1.2.4.0 (1.2.4.0)