Permalink
Browse files

Initial tests for socket.io.

Currently we can send the handshake but Socket.IO always drops saying
that - destroying non-socket.io upgrade

And doesn't even send the handshake back.
  • Loading branch information...
1 parent c13bf8c commit 2eee75d75864bee1470823756d1e4d051db138a1 @pk committed Apr 22, 2012
Showing with 24 additions and 3 deletions.
  1. +5 −3 PKWebSocketTests/PKWebSocketTests.m
  2. +19 −0 PKWebSocketTests/Servers/socketio.js
@@ -11,6 +11,7 @@
#import "PKWebSocket.h"
#import "PKWebSocketMessage.h"
#import "PKWebSocketHandler-Hixie76.h"
+//#import "PKWebSocketHandler-RFC6455.h"
@interface PKWebSocketTests : SenTestCase <PKWebSocketDelegate>
@end
@@ -25,6 +26,7 @@ - (void)setUp {
_finished = NO;
_handler = [[PKWebSocketHandlerHixie76 alloc] init];
+ //_handler = [[PKWebSocketHandlerRFC6455 alloc] init];
}
- (void)tearDown {
@@ -34,8 +36,8 @@ - (void)tearDown {
}
- (NSString *)standardURL {
- return @"ws://echo.websocket.org";
- //return @"ws://localhost:10000";
+ //return @"ws://echo.websocket.org";
+ return @"ws://localhost:10000";
}
- (NSString *)secureURL {
@@ -92,7 +94,7 @@ - (void)testTestSecureConnectionShouldBeSuccessful {
handler:_handler
delegate:self];
[ws setTLSSettings:tlsSettings];
-
+
STAssertTrue([ws openWithError:&error],nil);
NSRunLoop *theRL = [NSRunLoop currentRunLoop];
@@ -0,0 +1,19 @@
+var io = require('socket.io').listen(10000);
+io.configure(function() {
+ io.set('transports', ['websocket']);
+ io.set('log level', 3);
+ io.disable('browser client');
+ io.enable('destroy upgrade');
+})
+
+io.sockets.on('connection', function (socket) {
+ console.log('Client connected...');
+
+
+ socket.on('message', function () {
+ socket.emmit('Hello');
+ });
+ socket.on('disconnect', function () {
+ console.log('Client gone...');
+ });
+});

0 comments on commit 2eee75d

Please sign in to comment.