Install SocketRocket via Carthage
mainTo install SocketRocket using Carthage, add the following line to your Cartfile:
github "facebook/SocketRocket"Then, run carthage update to fetch the latest version into your Carthage folder.
repository·main·Indexed 27 days ago
https://github.com/facebookincubator/socketrocketA conforming WebSocket (RFC 6455) client library for iOS, macOS, tvOS, and visionOS. SocketRocket provides an asynchronous, non-blocking interface via the SRWebSocket class and SRWebSocketDelegate protocol, supporting TLS, HTTP proxies, and SSL certificate pinning.
To install SocketRocket using Carthage, add the following line to your Cartfile:
github "facebook/SocketRocket"Then, run carthage update to fetch the latest version into your Carthage folder.
SocketRocket includes setup scripts for a Python testing environment using virtualenv.
To run the short test suite:
make testTo run the full test suite (including all tests):
make test_allAlternatively, you can run tests inside Xcode by selecting the SocketRocketTests target and running the test action (⌘+U) on a Mac or Simulator.
To install SocketRocket using CocoaPods, add the following line to your Podfile:
pod 'SocketRocket'Then, run pod install in your terminal to complete the setup.
The TestChat demo application requires a running server. You can use the provided Python implementation which uses Tornado.
make test in the root directory.source .env/bin/activate
pip install git+https://github.com/tornadoweb/tornado.gitpython TestChatServer/py/chatroom.pyAlternatively, you can use the Go implementation:
cd TestChatServer/go
go run chatroom.gosource .env/bin/activate
pip install git+https://github.com/tornadoweb/tornado.git
python TestChatServer/py/chatroom.pyTo run the TestChat demo application using the Go implementation, use the go run command on the chatroom.go file.
go run chatroom.goThe SRWebSocket class is the primary interface for WebSocket communication. It conforms to RFC 6455 and supports TLS (wss), HTTP Proxies, and IPv4/IPv6.
Important Note on Memory Management: SRWebSocket will retain itself between the call to -(void)open and when it closes, errors, or fails. However, unlike NSURLConnection, SRWebSocket will not retain its delegate.
SRWebSocketDelegate protocol. The following methods are optional: