Professional Documents
Culture Documents
9. {
10.
NSLog(@"connection success");
11.
[[WarpClient getInstance] joinRoom:@"RoomId"];
12.
}
13.
else
14.
{
15.
NSLog(@"connection failed");
16.
}
17.
}
18.
-(void)onDisconnectDone:(ConnectEvent*) event
19.
{
20.
NSLog(@"On Disconnect invoked");
21.
}
Once you have supplied all the listeners you have to call the connectWithUserName() method
of WarpClient to connect to the AppWarp server and join the Zone by giving in the user name
as a parameter with which the client wishes to join the online application.
view plaincopy to clipboardprint?
1. [[WarpClient getInstance] connectWithUserName:@"Jonny"];
Once you have successfully joined, you can either join the lobby or join a particular room. You
should also subscribe the lobby or the room joined to catch the notifications generated in that
particular room or lobby
view plaincopy to clipboardprint?
1. [[WarpClient getInstance] joinRoom:@"RoomId"];
2. [[WarpClient getInstance]subscribeRoom:@"RoomId"];
To exchanges messages you can either send messages in plain text format
using sendChat method or send encrypted data using sendUpdatePeers method respectively.
To catch the messages sent through sendChat method, use the onChatReceived method of
MyNotificationListener and to catch the data sent through sendUpdatePeers method, use
the onUpdatePeersReceived method of MyNotificationListener.
Appwarp also allows you to set custom data for users and rooms through the
methods setCustomUserData andsetCustomRoomData. To retrieve the custom data
and other information WarpClient
comprises getLiveUserInfoand getLiveRoomInfo methods.