Wednesday, 12 April 2017

Connect to Heroku socket from another server/localhost

I have a nodejs/express app deployed on heroku with socket.io listening on port 80.

I want to connect to the app's socket from localhost which will be pushed to github-pages. I'm getting net::ERR_SSL_PROTOCOL_ERROR error in the GET request.

This is my server code deployed on heroku.

    var app = require('express')();
    var server = require('http').Server(app);
    var io = require('socket.io')(server);

    server.listen(80);

    io.on('connection', function(){

    }); 

My localhost is running on webpack-dev-server.

    import io from 'socket.io-client'; 
    const socket = io.connect('https://tank3d.herokuapp.com:80');

Everything is fine if I run the server locally.



via Lun Zhang

No comments:

Post a Comment