intergram icon indicating copy to clipboard operation
intergram copied to clipboard

socket.io problem

Open fooness opened this issue 7 years ago • 4 comments

Dear community,

could anyone please tell me, how to configure socket.io when self-hosting this service? And where the files should be located? Because node projects shouldn’t be in the document root.

I’m getting one of these errors:

  1. GET https://server_url/socket.io/?EIO=3&transport=polling&t=LmqFgWp 404 (Not Found)

  2. using a rewrite rule RewriteRule ^socket\.io(.*)? http://localhost:61148%{REQUEST_URI} [P] WebSocket connection to 'wss://server_url/socket.io/?EIO=3&transport=websocket&sid=some-ID-foo' failed: Error during WebSocket handshake: Unexpected response code: 400

I’m using this variable: window.intergramServer = window.location.origin + "/hook"; which resolves to my-domain.com/hook—is this correct?

And how does the webhook need to be set up? To e.g. https://api.telegram.org/botxxx:yyy/setWebhook?url=my-domain.com/livechat/hook or do you specify a protocol, too, like in https://api.telegram.org/botxxx:yyy/setWebhook?url=https://my-domain.com/livechat/hook

fooness avatar May 22 '17 21:05 fooness

Hi I have the same , could any one help us? Thanks

mvardin avatar Aug 21 '17 13:08 mvardin

I will need more information to help, but few points - This is the right wss url structure - wss://www.intergram.xyz/socket.io/?EIO=3&transport=websocket&sid=SOME-ID

Did you enabled SSLon your server? Did you pass the SSL certificate to the node process? This requires some changes to the server.js file.

Also when pointing to server url from the web (window.intergramServer), do not point to the /hook endpoint. The /hook endpoint is used only by Telegram to pass messages from the admin to the server (which handles them and sends them to the web chat if needed)

So please share more information about the steps you have taken so far and the current situation (You can also email me - ido.mapchat at gmail dot com)

idoco avatar Aug 21 '17 14:08 idoco

Thanks for your response I've just set bot_token and set telegram web-hook for my bot and build ...

1- Did you enabled SSL on your server? yes 2- Did you pass the SSL certificate to the node process? how ?!

mvardin avatar Aug 23 '17 13:08 mvardin

Hi @mvardin the server.js file needs to be changed to use an https server instead of http and to use the server's private key and certificate.

Start by looking at this example, and see if that works for you.

idoco avatar Aug 26 '17 19:08 idoco