Chrome Extension Socket io node js

前端 未结 2 800
名媛妹妹
名媛妹妹 2021-02-03 11:11

I need to create a chrome extension which shows a notification when we get a message from socket io node js server.

How to include socket io in chrome extension? I am n

2条回答
  •  借酒劲吻你
    2021-02-03 11:42

    Note in 2020:

    Rahat's answer is fine except the socket version , when you use it in background script it always reconnects , so if you use inappropriate version of socket.io.js you 'll get something like this

    but with socket.io.js 2.3.0 worked correctly as it should here is a link which worked for me https://cdn.jsdelivr.net/npm/socket.io-client@2/dist/socket.io.js

    More info at https://www.npmjs.com/package/socket.io-client

提交回复
热议问题