Как подключить socket.io к openshift?

Создал небольшую страницу nodejs + express, в которой использую socket.io.

NodeJS сервер загрузил на OpenShift, всё сделал по мануалу, сервер запускается и работает. Однако, когда пытаюсь подключиться к серверу со своей странички, получаю ошибку: net::ERR_CONNECTION_REFUSED.

Важно, что страничку-клиент загружаю не с сервера, а храню на локальном компьютере (так надо, ну вот надо хоть умри) .

Пишу в клиенте: var socket = io('http://IP моего сервера:8080');.

И не работает, помогите t_t
  • Вопрос задан
  • 256 просмотров
Решения вопроса 1
@catHD
var socket = io();

В дефолте socket подключится туда, откуда он "прилетел"


IO(url:String, opts:Object):Socket
Exposed as the io global in window if using the standalone build (eg: /socket.io/socket.io.js or the CDN), or the result of calling require('socket.io-client').

When called, it creates a new Manager for the given URL, and attempts
to reuse an existing Manager for subsequent calls, unless the
multiplex option is passed with false. Passing this option is the equivalent of passing 'force new connection': true.

The rest of the options are passed to the Manager constructor (see below
for details).

A Socket instance is returned for the namespace specified by the
pathname in the URL, defaulting to /. For example, if the url is
localhost/users, a transport connection will be established to
localhost and a Socket.IO connection will be established to
/users.
Ответ написан
Комментировать
Пригласить эксперта
Ваш ответ на вопрос

Войдите, чтобы написать ответ

Войти через центр авторизации
Похожие вопросы