A
A
Alexey Maksimov2016-01-25 23:56:38
JavaScript
Alexey Maksimov, 2016-01-25 23:56:38

Why doesn't socket.io use WebSockets?

When connecting to a socket.io server socket = io.connect('http://url.ru:8080')on any browser, the connection is established via the polling transport, although all tested browsers fully support WebSocket. Why is this happening?
Console output when connected:

XHR finished loading: GET "http://url.ru:8880/socket.io/?EIO=3&transport=polling&t=L9wWYBs"
XHR finished loading: GET "http://url.ru:8880/socket.io/?EIO=3&transport=polling&t=L9wWYEi&sid=63pyat2zy79oWsoxAAAC"
XHR finished loading: GET "http://url.ru:8880/socket.io/?EIO=3&transport=polling&t=L9wWYZq&sid=63pyat2zy79oWsoxAAAC".

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexey Maksimov, 2016-01-26
@additivex

Understood.

socket = io.connect('http://url.ru:8080', {transports: ['websocket', 'flashsocket', 'xhr-polling']});

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question