SFS2X Objective-C API  1.7.13
iOS / macOS / tvOS
ExtensionRequest.h
1 //
2 // ExtensionRequest.h
3 // SFS2X
4 //
5 // Original development by Infosfer Game Technologies Ltd. | http://www.infosfer.com.
6 //
7 // Maintained and developed by A51 Integrated.
8 // Copyright 2012 A51 Integrated | http://a51integrated.com. All rights reserved.
9 //
10 
11 
12 #import "BaseRequest.h"
13 #import "Room.h"
14 
15 EXTERN NSString * const ExtensionRequest_KEY_CMD;
16 EXTERN NSString * const ExtensionRequest_KEY_PARAMS;
17 EXTERN NSString * const ExtensionRequest_KEY_ROOM;
18 EXTERN NSString * const ExtensionRequest_KEY_UDP;
19 
20 /**
21  Sends a request to a Zone or Room Extension.
22 
23  Each request to an extension is characterized by two parameters:
24 
25  - <b>command name:</b> any string that identifies an action that should be executed on the server side. We recommend to use the same command name for both the client request and the server response.
26  - <b>request data:</b> you can send any simple or complex data structures to your extension(s) via the SFSObject class
27 
28  */
29 @interface ExtensionRequest : BaseRequest {
30 
31  NSString *_extCmd;
32  id<ISFSObject> _params;
33  id<Room> _room;
34 }
35 
36 
37 
38 -(id)initWithExtCmd:(NSString *)extCmd params:(id<ISFSObject>)params room:(id<Room>)room isUDP:(BOOL) udp;
39 
40 /**
41  @param extCmd the command name
42  @param params the custom extension request data
43  @param room when specified it will send the request to the Room Extension. The user must be joined in that Room.
44  @param udp whether the extension should be sent via UDP (YES) or TCP (NO)
45 
46  The following example shows usage.
47 
48  SFSObject *obj = [SFSObject newInstance];
49  [obj putUtfString:@"m" value:@"Hello World!"];
50  [smartFox send:[ExtensionRequest requestWithExtCmd:@"myCmd" params:obj udp:NO]];
51 
52  @see [ISFSEvent onExtensionResponse:]
53 
54  */
55 +(id)requestWithExtCmd:(NSString *)extCmd params:(id<ISFSObject>)params room:(id<Room>)room udp:(BOOL) udp;
56 +(id)requestWithExtCmd:(NSString *)extCmd params:(id<ISFSObject>)params room:(id<Room>)room;
57 +(id)requestWithExtCmd:(NSString *)extCmd params:(id<ISFSObject>)params udp:(BOOL) udp;
58 +(id)requestWithExtCmd:(NSString *)extCmd params:(id<ISFSObject>)params;
59 
60 @end
ExtensionRequest
Definition: ExtensionRequest.h:29