I have developed one chat application using socket and node js , in start it works perfectly but i have observed that after some interval of time there is one polling error thrown and than socket disconnects.
Error screenshot : https://drive.google.com/file/d/1RWAoqHmpRSR1RkNvE1-XsFtVIvBX24bY/view?usp=sharing
This might fix the issue:
Add this line on server.js:
io.set('transports', ['websocket']);
Add this on client.js:
var socket = io('/',{transports: ['websocket'],upgrade:false});
And do one more thing just use lower socket.io version like 2.0.3
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.