Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 3 additions & 5 deletions .github/workflows/workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,11 @@ jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
with:
fetch-depth: 1
- uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v1
uses: actions/setup-node@v4
with:
node-version: 14.15.1
node-version: 22
- name: Installing dependencies
run: npm install
- name: Running tests
Expand Down
10 changes: 7 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,17 +72,21 @@ socket.onopen = (event) => {

The websocket server could even make *arbitrary calls to the client!*

#### on the server:
#### on the server (using [ws](https://github.com/websockets/ws)):
```javascript
import rawr, { transports } from 'rawr';

socketServer.on('connection', (socket) => {
const peer = rawr({
transport: transports.websocket(socket)
const peer = rawr({
transport: transports.websocket(socket)
});

const result = await peer.methods.doSomethingOnClient();
});
```

The websocket transport works with both browser WebSocket and Node.js [ws](https://github.com/websockets/ws) library.

## Handling Notifications

Peers can also send each other [notifications](https://www.jsonrpc.org/specification#notification):
Expand Down
Loading