facebookincubator/SocketRocket is a open-source project on GitHub, written primarily in Objective-C. It has 9.6k stars. A conforming Objective-C WebSocket client library.
Snapshot summary built from the project's own GitHub metadata — there's no written TopGit review yet. The page will update automatically when a full review is published.
WHY NO REVIEW YET
TopGit writes full reviews for the most-starred, most-requested repositories. This page is a snapshot until then — see the READ ME tab for the original README in full.
A conforming WebSocket (RFC 6455) client library for iOS, macOS, tvOS and visionOS.
Test results for SocketRocket here.
You can compare to what modern browsers look like here.
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).
Features/Design
TLS (wss) support, including self-signed certificates.
Seems to perform quite well.
Supports HTTP Proxies.
Supports IPv4/IPv6.
Supports SSL certificate pinning.
Sends ping and can process pong events.
Asynchronous and non-blocking. Most of the work is done on a background thread.
Supports iOS, macOS, tvOS.
Installing
There are a few options. Choose one, or just figure it out:
CocoaPods
Add the following line to your Podfile:
pod 'SocketRocket'
Run pod install, and you are all set.
Carthage
Add the following line to your Cartfile:
github "facebook/SocketRocket"
Run carthage update, and you should now have the latest version of SocketRocket in your Carthage folder.
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.
API
SRWebSocket
The Web Socket.
Note:
SRWebSocket will retain itself between -(void)open and when it closes, errors, or fails.
This is similar to how NSURLConnection behaves (unlike NSURLConnection, SRWebSocket won't retain the delegate).
Interface
@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
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:
make test
To run all the tests, run:
make test_all
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 SocketRocketTests target
Make sure your running destination is either your Mac or any Simulator
Run the test action (⌘+U)
TestChat Demo Application
SocketRocket includes a demo app, TestChat.
It will "chat" with a listening websocket on port 9900.
TestChat Server
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:
In the same terminal session, start the chatroom server:
python TestChatServer/py/chatroom.py
There's also a Go implementation (with the latest weekly) where you can:
cd TestChatServer/go
go run chatroom.go
Chatting
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:
Tornado
Go's WebSocket package or Gorilla's version.
Autobahn (using its fuzzing client).
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.
Contributing
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.
Does facebookincubator/SocketRocket have a project website?
No homepage URL was recorded for facebookincubator/SocketRocket in TopGit's last sync. The README tab above frequently contains screenshots and demo links, or check the repository description on GitHub.
Does facebookincubator/SocketRocket have any tags?
TopGit's last sync did not record any GitHub topics for facebookincubator/SocketRocket. GitHub topics appear in the right sidebar of a repository page; that's the authoritative place to check.
How active is development on facebookincubator/SocketRocket?
The most recent commit recorded on facebookincubator/SocketRocket was 11 months ago, based on the GitHub push timestamp. The repository has 2.0k forks — one of the better signals of community interest.
How many stars does facebookincubator/SocketRocket have?
facebookincubator/SocketRocket has 9.6k GitHub stars — refresh the page for the live number, or check github.com/facebookincubator/SocketRocket. TopGit mirrors GitHub's count but does not claim minute-by-minute accuracy.
Is facebookincubator/SocketRocket open source?
TopGit's metadata for facebookincubator/SocketRocket does not record a license. Most public repositories on GitHub ARE open source, but the exact terms vary — verify by opening the LICENSE file directly.
Where do I read more about facebookincubator/SocketRocket?
This TopGit page is a snapshot — the READ ME tab shows the project's own README content (links stripped, images preserved). The GitHub repository at github.com/facebookincubator/SocketRocket is the definitive source.
Read full README in the tab above.
Still deciding about SocketRocket?
One click hands the question to an AI along with this page — see what it says about SocketRocket.