Wednesday, 24 May 2017

Node.js + Socket.io app - not work in heroku

In my app not connects socket.io.

my app.js (server)

app.set('port',3000)
let server = app.listen(app.get('port'))
var io = require('socket.io').listen(server)
global.io = io

index.js (client)

const socket = io.connect('https://xxx-my-secret-app.herokuapp.com')

browser console

POST https://evening-savannah-51961.herokuapp.com/socket.io/?EIO=3&transport=polling&t=Lmx1tkf 404 (Not Found)

responce html

<!DOCTYPE html><html><head><title></title><link rel="stylesheet" href="/stylesheets/style.css"></head><body><h1>Not Found</h1><h2></h2><pre></pre></body></html>

dependencies:

"dependencies": { "body-parser": "~1.17.1", "connect": "^3.6.0", "connect-mongo": "^1.3.2", "cookie": "^0.3.1", "cookie-parser": "~1.4.3", "cookie-session": "^2.0.0-beta.1", "cors": "^2.8.3", "crypto": "0.0.3", "debug": "~2.6.3", "express": "~4.15.2", "express-formidable": "^1.0.0", "express-session": "^1.15.2", "fs": "0.0.1-security", "gravatar": "^1.6.0", "gravatary": "^1.0.0", "https": "^1.0.0", "mongoose": "^4.9.4", "morgan": "~1.8.1", "multer": "^1.3.0", "nodejs-gravatar": "^1.0.2", "passport": "^0.3.2", "passport-local": "^1.0.0", "passport.socketio": "^3.7.0", "pnglib": "0.0.1", "pug": "~2.0.0-beta11", "randomstring": "^1.1.5", "serve-favicon": "~2.4.2", "socket.io": "^1.7.3", "socketio-jwt": "^4.5.0"

My application is a multi-user chat. For the client application I use Angular 4



via Макс Лолин

No comments:

Post a Comment