Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/methodgrab/socketio-proxy-boilerplate
An example of using http-proxy to proxy WebSocket requests to a separate server
https://github.com/methodgrab/socketio-proxy-boilerplate
boilerplate socket-io
Last synced: 9 days ago
JSON representation
An example of using http-proxy to proxy WebSocket requests to a separate server
- Host: GitHub
- URL: https://github.com/methodgrab/socketio-proxy-boilerplate
- Owner: MethodGrab
- Created: 2016-01-14T08:55:33.000Z (almost 9 years ago)
- Default Branch: master
- Last Pushed: 2016-01-14T08:58:28.000Z (almost 9 years ago)
- Last Synced: 2024-04-14T22:49:48.489Z (7 months ago)
- Topics: boilerplate, socket-io
- Language: JavaScript
- Homepage:
- Size: 2.93 KB
- Stars: 15
- Watchers: 2
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Socket.io Proxy Boilerplate
An example of using `http-proxy` to proxy WebSocket requests to a separate server.## Usage
- `npm install`
- `npm start`
(or `npm run start:dev` to use nodemon & show debug messages)
- Open http://localhost:4000 in the browser and check the consoleTo show debug messages in the browser use:
```js
localStorage.setItem( 'debug', 'socket.io-client:*,-socket.io-client:socket' );
```## Testing
To verify that sockets are being used instead of polling, open the dev tools `Network` tab and find the request using the `websocket` protocol.
It should have a status code of `101 Switching Protocols` and it's `frames` tab should show all the incoming `ping` messages from the server.## Notes
- Socket.io will still do some (~3) initial polling requests before `upgrade`ing to a WebSocket connection.
If you change the clientside `transports` to `transports : ['websocket']` these initial polling requests will stop but you lose the polling fallback.