iOS SDK API Reference

Instance Methods | Properties | List of all members
SKWRoom Class Reference

Room base class. More...

#import <SKWRoom.h>

Inheritance diagram for SKWRoom:
SKWMeshRoom SKWSFURoom

Instance Methods

(BOOL) - send:
 Send data to all participants in the room with WebSocket. More...
 
(void) - on:callback:
 Set blocks for SKWRoom events. More...
 
(void) - offAll
 Cancels the set event callback block of SKWRoom. More...
 
(void) - getLog
 Start getting room's logs from signaling server. More...
 

Properties

NSString *__nullable name
 Room name.
 

Detailed Description

Room base class.

Method Documentation

◆ getLog

- (void) getLog

Start getting room's logs from signaling server.

The result is returned in the SKW_ROOM_EVENT_LOG event.

SKWRoom* room;
[room on:SKW_ROOM_EVENT_LOG callback:^(NSObject* obj) {
NSArray* logs = (NSArray*)obj;
[logs enumerateObjectsUsingBlock:^(id obj, NSUInteger idx, BOOL* stop) {
NSString* logStr = (NSString*)obj;
NSError* error = nil;
id logData = [NSJSONSerialization JSONObjectWithData:[logStr dataUsingEncoding:NSUTF8StringEncoding]
options:0
error:&error];
if (nil == error)
{
NSLog(@"SKW_ROOM_EVENT_LOG: %@", logData);
}
}];
}];
[room getLog];

◆ offAll

- (void) offAll

Cancels the set event callback block of SKWRoom.

SKWRoom* room;
[room offAll];

◆ on:callback:

- (void) on: (SKWRoomEventEnum event
callback: (SKWRoomEventCallback __nullable)  callback 

Set blocks for SKWRoom events.

SKWRoom* room;
[room on:SKW_ROOM_EVENT_STREAM callback:^(NSObject* obj) {
SKWMediaStream* stream = (SKWMediaStream*)obj;
}];
[room on:SKW_ROOM_EVENT_REMOVE_STREAM callback:^(NSObject* obj) {
SKWMediaStream* stream = (SKWMediaStream*)obj;
}];
[room on:SKW_ROOM_EVENT_OPEN callback:^(NSObject* obj) {
NSString* roomName = (NSString*)obj;
}];
[room on:SKW_ROOM_EVENT_CLOSE callback:^(NSObject* obj) {
NSString* roomName = (NSString*)obj;
}];
[room on:SKW_ROOM_EVENT_PEER_JOIN callback:^(NSObject* obj) {
NSString* peerId = (NSString*)obj;
}];
[room on:SKW_ROOM_EVENT_PEER_LEAVE callback:^(NSObject* obj) {
NSString* peerId = (NSString*)obj;
}];
[room on:SKW_ROOM_EVENT_ERROR callback:^(NSObject* obj) {
SKWPeerError* error = (SKWPeerError*)obj;
}];
[room on:SKW_ROOM_EVENT_DATA callback:^(NSObject* obj) {
SKWRoomDataMessage* msg = (SKWRoomDataMessage*)obj;
NSString* peerId = msg.src;
if ([msg.data isKindOfClass:[NSString class]]) {
NSString* data = (NSString*)msg.data;
}
else if ([msg.data isKindOfClass:[NSData class]]) {
NSData* data = (NSData*)msg.data;
}
}];
[room on:SKW_ROOM_EVENT_LOG callback:^(NSObject* obj) {
NSArray* logs = (NSArray*)obj;
}];
Parameters
eventEvent type
callbackCallback block literal

◆ send:

- (BOOL) send: (NSObject *__nonnull)  data

Send data to all participants in the room with WebSocket.

It emits broadcast event. The max size of data that can be sent is 20MB. The frequent of consecutive send is limited to once every 100 msec. Outgoing data that exceeds the sending frequency limit is queued and sent sequentially every 100 msec.

SKWRoom* room;
[room send:@"Hello."];
Parameters
dataSend data
Returns
Result.
-[SKWRoom send:]
BOOL send:(NSObject *__nonnull data)
Send data to all participants in the room with WebSocket.
SKWRoomDataMessage
Data received from peer.
Definition: SKWRoomDataMessage.h:14
SKWPeerError
Error information class.
Definition: SKWPeerError.h:76
-[SKWRoom on:callback:]
void on:callback:(SKWRoomEventEnum event,[callback] SKWRoomEventCallback __nullable callback)
Set blocks for SKWRoom events.
-[SKWRoom offAll]
void offAll()
Cancels the set event callback block of SKWRoom.
-[SKWRoom getLog]
void getLog()
Start getting room's logs from signaling server.
SKWMediaStream
Media stream.
Definition: SKWMediaStream.h:18
SKWRoom
Room base class.
Definition: SKWRoom.h:70