HTML and CSS Reference
In-Depth Information
}
- (void)didReceiveBinaryMessage:(NSData
*)aMessage
{
// JavaScript event: onmessage
}
@end
4. It is now time to populate the methods, as we did in the JavaScript samples.
Here's what you need to do in order to set the app up and running:
// ViewController.h
@interface ViewController :
UIViewController <WebSocketDelegate>
{
// Create a new WebSocket object.
WebSocket *socket;
}
// ViewController.m
- (void)viewDidLoad
{
[super viewDidLoad];
// Specify the WebSocket configuration.
The only necessary parameter is the URL.
WebSocketConnectConfig *config =
[WebSocketConnectConfig
configWithURLString:@"ws://echo.websocket.org"
origin:nil protocols:nil
tlsSettings:nil headers:nil
verifySecurityKey:YES
extensions:nil];
Search WWH ::




Custom Search