SFS2X Objective-C API  1.7.13
iOS / macOS / tvOS
ExtensionRequest Class Reference

#import <ExtensionRequest.h>

Inherits BaseRequest.

Instance Methods

(id) - initWithExtCmd:params:room:isUDP:
 

Class Methods

(id) + requestWithExtCmd:params:room:udp:
 
(id) + requestWithExtCmd:params:room:
 
(id) + requestWithExtCmd:params:udp:
 
(id) + requestWithExtCmd:params:
 

Protected Attributes

NSString * _extCmd
 
id< ISFSObject > _params
 
id< Room > _room
 

Detailed Description

Sends a request to a Zone or Room Extension.

Each request to an extension is characterized by two parameters:

  • command name: 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.
  • request data: you can send any simple or complex data structures to your extension(s) via the SFSObject class

Method Documentation

◆ requestWithExtCmd:params:room:udp:

+ (id) requestWithExtCmd: (NSString *)  extCmd
params: (id<ISFSObject>)  params
room: (id<Room>)  room
udp: (BOOL)  udp 
Parameters
extCmdthe command name
paramsthe custom extension request data
roomwhen specified it will send the request to the Room Extension. The user must be joined in that Room.
udpwhether the extension should be sent via UDP (YES) or TCP (NO)

The following example shows usage.

SFSObject *obj = [SFSObject newInstance];
[obj putUtfString:@"m" value:@"Hello World!"];
[smartFox send:[ExtensionRequest requestWithExtCmd:@"myCmd" params:obj udp:NO]];
See also
[ISFSEvent onExtensionResponse:]