• This repository has been archived on 05/Dec/2019
  • Stars
    star
    249
  • Rank 162,987 (Top 4 %)
  • Language
    Objective-C
  • License
    MIT License
  • Created over 11 years ago
  • Updated over 9 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

A simple WebSocket server

RockemSockem

RockemSockem isn't just an awesome name. It's a super-simple, ReactiveCocoa-based WebSocket server for OS X.

It uses CocoaHTTPServer to do all the hard stuff. Because the hard stuff is hard. Basically all the credit goes to them.

How do I use it?

  1. Add RockemSocket.xcodeproj to your project or workspace.
  2. Add RockemSockem to your Target Dependencies.
  3. Add RockemSockem.framework to your Link Binary with Libraries.
  4. Add RockemSockem.framework to a Copy Files phase which copies it into Frameworks.
  5. Weep that this list of instructions is so damn long.
  6. Follow all those same steps, but for ReactiveCocoa (in External).
server = [[RSMServer alloc] init];
server.port = 12345;
server.interface = @"localhost";
[server.webSockets subscribeNext:^(RSMWebSocket *socket) {
	[socket sendMessage:@"Sock it to me."];
	[socket.messages subscribeNext:^(NSString *message) {
		NSLog(@"Got \"%@\" from %@", message, socket);
	}];
}];

NSError *error;
BOOL success = [server start:&error];
if (!success) {
	NSLog(@"Error starting server: %@", error);
}

See RockemSockemSample for a slightly complete example.

If youโ€™re developing RockemSockem on its own, then simply open RockemSockem.xcworkspace.

What about iOS?

If you're running a WebSocker server on iOS I feel bad for you son. I got 99 problems and RockemSockem not running on iOS ain't one. (Pull requests welcome.)