I'm using CloudFlare to implement a REST API. I need to add some notifications which are implemented with socket.io on Node.JS. When socket.io uses a live connection to keep client updated it will work because the connection is established between server-client, but what happens when socket.io does polling? Does CloudFlare use always the same server for each client?
相关问题
- npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fs
- google-drive can't get push notifications
- How to reimport module with ES6 import
- Why is `node.js` dying when called from inside pyt
- How to verify laravel passport api token in node /
相关文章
- node连接远程oracle报错
- How can make folder with Firebase Cloud Functions
- @angular-cli install fails with deprecated request
- node.js modify file data stream?
- How to resolve hostname to an ip address in node j
- Transactionally writing files in Node.js
- Log to node console or debug during webpack build
- Get file created date in node
WebSockets are standardised by the IETF in RFC 6455, this allows you to avoid polling behaviour and instead directly maintain a bi-directional connection from the server to the client.
Whilst your existing stack (Node.js, Socket.io and CloudFlare) support polling behaviour; Socket.io can use WebSockets and CloudFlare now supports WebSockets!
WebSockets don't use traditional polling and instead act as a full-duplex communication protocol. When it is possible Socket.io will seek to use WebSockets when it can but fallback to polling when it can.
So what do you need to bear in mind? When using WebSockets be sure to use Ports that are acceptable to CloudFlare.
There is an FAQ for using CloudFlare with WebSockets.