https://github.com/ritik48/cloudflare-socket
https://github.com/ritik48/cloudflare-socket
Last synced: 2 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/ritik48/cloudflare-socket
- Owner: ritik48
- Created: 2024-06-08T20:06:46.000Z (about 1 year ago)
- Default Branch: main
- Last Pushed: 2024-06-08T20:06:55.000Z (about 1 year ago)
- Last Synced: 2025-03-21T10:54:25.920Z (3 months ago)
- Language: TypeScript
- Size: 37.1 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
#### How to use
1. Run: `npm run dev`
2. Open two hoppscoth client for two clients (https://hoppscotch.io/realtime/websocket)
3. For 1st client `ws://127.0.0.1:8787?name="Client_1"`
4. For 2nd client `ws://127.0.0.1:8787?name="Client_2"`
5. Now, from client 1, send the folllowing json one by one:
`{"type: "client_ready"}`
`{"type: "init"}`
6. Now repeat step 5 for client 2, you will notice that , on sending
`{"type: "init"}`
the client diconnect with the error:
```
X [ERROR] Uncaught Error:
Cannot perform I/O on behalf of a different request. I/O objects (such as streams, request/response bodies, and others) created in the context of one request handler cannot be accessed from a different request's handler. This is a limitation of Cloudflare Workers which allows us to improve overall performance. (I/O type: Native)
```