Skip to content

Commit 4040741

Browse files
committed
Fixed typo
1 parent 8d0ac71 commit 4040741

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

readme.md

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
`ioRPC` — is a lightweight module for implementing a mechanism for remote asynchronous function calls between different scripts using various transports, for example, WebSockets. This module allows you to call functions on a remote API and send responses with a minimum of configuration. Allows you to call a JavaScript function on another computer. Works both on nodejs and in the browser.
44

5-
## Concept
5+
## Example
66

77
Create functions that can be called remotely by passing function references
88
```javascript
@@ -90,6 +90,9 @@ If export is not specified, it will create a global variable:
9090
RequireJS, Webpack, Vite packagers, and more.
9191

9292
# iorpc and websocket integration
93+
94+
You can try this example on stackblitz.com [HERE](https://stackblitz.com/edit/stackblitz-starters-j9v4dm61?file=wsHost.js,wsClient.js).
95+
9396
## Example websocket host (wsHost.js)
9497
This code snippet demonstrates the initialization of the module `iorpc` for working with WebSocket.
9598

@@ -157,7 +160,7 @@ const localApi = {
157160
}
158161
}
159162

160-
const wss = new WebSocket.Server({ port: 8080 })
163+
const wss = new WebSocketServer({ port: 8080 })
161164
wss.on('connection', ws => {
162165
const { routeInput, remoteApi } = createIorpc(data => ws.send(JSON.stringify(data)), localApi)
163166
ws.on('message', data => routeInput(JSON.parse(data))) // incoming messages are passed to 'routeInput' for processing via iorpc.

0 commit comments

Comments
 (0)