https://github.com/bandwidth/json-rpc-websockets
https://github.com/bandwidth/json-rpc-websockets
Last synced: 3 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/bandwidth/json-rpc-websockets
- Owner: Bandwidth
- License: mit
- Created: 2020-12-09T22:16:35.000Z (over 4 years ago)
- Default Branch: main
- Last Pushed: 2021-02-04T16:06:31.000Z (over 4 years ago)
- Last Synced: 2025-01-15T04:19:21.623Z (5 months ago)
- Language: Swift
- Homepage:
- Size: 31.3 KB
- Stars: 0
- Watchers: 8
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.txt
Awesome Lists containing this project
README
# JSON-RPC WebSockets
JSON-RPC WebSockets is an open-source implementation of [JSON-RPC 2.0](https://www.jsonrpc.org/specification) using WebSockets.
Inspired by [rpc-websockets](https://www.npmjs.com/package/rpc-websockets).
```swift
let client = Client()struct FeedUpdatedParameters: Codable {
}
// Subscribe to receiving notifications from the server.
try client.subscribe(to: "feedUpdated", type: FeedUpdatedParameters.self)// Execute a closure when a subscribed notification has been received.
client.on(method: "feedUpdated", type: FeedUpdatedParameters.self) { parameters in}
let parameters = FeedUpdatedParameters()
// Send a notification to the server.
client.notify(method: "openedNewsModule", parameters) { result in}
// Connect to the server.
client.connect(url: url) {}
// Disconnect from the server.
client.disconnect {}
```## Compatibility
JSON-RPC WebSockets follows [SemVer 2.0.0](https://semver.org/#semantic-versioning-200).