SocketRocket alternatives and similar libraries
Based on the "WebSocket" category.
Alternatively, view SocketRocket alternatives based on common mentions on social networks and blogs.
9.4 1.7 L2 SocketRocket VS socket.io-client-swiftSocket.IO-client for iOS/OS X.
5.9 0.0 L2 SocketRocket VS Socks🔌 Non-blocking TCP socket layer, with event-driven server and client.
4.6 0.0 L3 SocketRocket VS Swift-ActionCableClientActionCable is a new WebSocket server being released with Rails 5 which makes it easy to add real-time features to your app. This Swift client makes it dead-simple to connect with that server, abstracting away everything except what you need to get going.
* Code Quality Rankings and insights are calculated and provided by Lumnify.
They vary from L1 to L5 with "L5" being the highest.
Do you think we are missing an alternative of SocketRocket or a related project?
A conforming WebSocket (RFC 6455) client library for iOS, macOS and tvOS.
SocketRocket currently conforms to all core ~300 of Autobahn's fuzzing tests (aside from two UTF-8 ones where it is merely non-strict tests 6.4.2 and 6.4.4).
- TLS (wss) support, including self-signed certificates.
- Seems to perform quite well.
- Supports HTTP Proxies.
- Supports IPv4/IPv6.
- Supports SSL certificate pinning.
pingand can process
- Asynchronous and non-blocking. Most of the work is done on a background thread.
- Supports iOS, macOS, tvOS.
There are a few options. Choose one, or just figure it out:
Add the following line to your Podfile:
pod install, and you are all set.
Add the following line to your Cartfile:
carthage update, and you should now have the latest version of
SocketRocket in your
- Using SocketRocket as a sub-project
You can also include
SocketRocket as a subproject inside of your application if you'd prefer, although we do not recommend this, as it will increase your indexing time significantly. To do so, just drag and drop the
SocketRocket.xcodeproj file into your workspace.
The Web Socket.
SRWebSocket will retain itself between
-(void)open and when it closes, errors, or fails.
This is similar to how
NSURLConnection behaves (unlike
SRWebSocket won't retain the delegate).
@interface SRWebSocket : NSObject // Make it with this - (instancetype)initWithURLRequest:(NSURLRequest *)request; // Set this before opening @property (nonatomic, weak) id <SRWebSocketDelegate> delegate; // Open with this - (void)open; // Close it with this - (void)close; // Send a Data - (void)sendData:(nullable NSData *)data error:(NSError **)error; // Send a UTF8 String - (void)sendString:(NSString *)string error:(NSError **)error; @end
You implement this
@protocol SRWebSocketDelegate <NSObject> @optional - (void)webSocketDidOpen:(SRWebSocket *)webSocket; - (void)webSocket:(SRWebSocket *)webSocket didReceiveMessageWithString:(NSString *)string; - (void)webSocket:(SRWebSocket *)webSocket didReceiveMessageWithData:(NSData *)data; - (void)webSocket:(SRWebSocket *)webSocket didFailWithError:(NSError *)error; - (void)webSocket:(SRWebSocket *)webSocket didCloseWithCode:(NSInteger)code reason:(nullable NSString *)reason wasClean:(BOOL)wasClean; @end
Included are setup scripts for the python testing environment. It comes packaged with vitualenv so all the dependencies are installed in userland.
To run the short test from the command line, run:
To run all the tests, run:
The short tests don't include the performance tests (the test harness is actually the bottleneck, not SocketRocket).
The first time this is run, it may take a while to install the dependencies. It will be smooth sailing after that.
You can also run tests inside Xcode, which runs the same thing, but makes it easier to debug.
- Choose the
- Run the test action (
TestChat Demo Application
SocketRocket includes a demo app, TestChat. It will "chat" with a listening websocket on port 9900.
The sever takes a message and broadcasts it to all other connected clients.
It requires some dependencies though to run. We also want to reuse the virtualenv we made when we ran the tests. If you haven't run the tests yet, go into the SocketRocket root directory and type:
This will set up your virtualenv.
Now, in your terminal:
source .env/bin/activate pip install git+https://github.com/tornadoweb/tornado.git
In the same terminal session, start the chatroom server:
There's also a Go implementation (with the latest weekly) where you can:
cd TestChatServer/go go run chatroom.go
Now, start TestChat.app (just run the target in the Xcode project). If you had it started already you can hit the refresh button to reconnect. It should say "Connected!" on top.
To talk with the app, open up your browser to http://localhost:9000 and start chatting.
WebSocket Server Implementation Recommendations
SocketRocket has been used with the following libraries:
The Tornado one is dirt simple and works like a charm. (IPython notebook uses it too). It's much easier to configure handlers and routes than in Autobahn/twisted.
We’re glad you’re interested in SocketRocket, and we’d love to see where you take it. Please read our contributing guidelines prior to submitting a Pull Request.
*Note that all licence references and agreements mentioned in the SocketRocket README section above are relevant to that project's source code only.