G
G
gelirgwenn2017-05-02 16:29:14
JavaScript
gelirgwenn, 2017-05-02 16:29:14

How to get data through socket.io over HTTPS?

Good day, citizens. There is a resource from which I receive data through the socket:

var socket = io.connect("http://socket.coincap.io");
    socket.on("trades", function(tradeMsg){
    // обработка данных
    });

The problem is that the resource works only via HTTP, and I have a site on HTTPS, which naturally blocks incoming data.
How can you get out of the situation?
I thought that on a subdomain you can create your own server on Node.js, which will receive data from the resource and send it to the client side. But something did not find examples, tell me where to read / see?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
D
DoumanAsh, 2017-05-02
@gelirgwenn

If the server is not accessible via https then there is no other way to directly access it from the https client. Simply because the browser by default blocks non-secure connections.
So there are only two options:
1. Ask the author of the server to provide access via wss
2. Make your own proxy that will forward wss <-> ws

D
dummyman, 2017-05-02
@dummyman

Based on socket.io, there is a disgracefully simple ws
package. Your case with the protocol wss:is almost at the very bottom.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question