Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error during WebSocket handshake: Status line does not end with CRLF #1493

Closed
cindoum opened this issue Apr 12, 2014 · 0 comments
Closed

Error during WebSocket handshake: Status line does not end with CRLF #1493

cindoum opened this issue Apr 12, 2014 · 0 comments

Comments

@cindoum
Copy link

cindoum commented Apr 12, 2014

Everytime socket try to connect i got an error :
WebSocket connection to 'wss://playground-c9-doum.c9.io/socket.io/1/websocket/QBGO1ZlPhWUBkMVQ9cUP' failed: Error during WebSocket handshake: Status line does not end with CRLF socket.io.js:2371

On server side :

var io = socket.listen(server);
var store = require('connect-mongo')(express);

io.set('authorization', passportSocketIo.authorize({
    passport: require('passport'),
    cookieParser: express.cookieParser,
    key:         'connect.sid',       // the name of the cookie where express/connect     stores its session_id
    secret:      constant.SALT,    // the session_secret to parse the cookie
    store:       new store({
        mongoose_connection: db,
        collection: constant.SESSION_COLLECTION,
    }),
    success:     onAuthorizeSuccess,  // *optional* callback on success - read more below
    fail:        onAuthorizeFail,
}));

io.sockets.on('connection', function (socket) {
    socket.on('chat:newText', function (data) {
        console.log(socket.handshake.user);
        data.username = socket.handshake.user.username;
        io.sockets.emit('chat:newText', data);
    });
});

client side :

var connect = function () {
    if (Auth.isLoggedIn() === true) {
        socket = io.connect();
        connected = true;
        return true;
    }
    else {
        console.log('Socket wont connect as user is not logged in');
        return false;
    }
};
@rauchg rauchg closed this as completed Nov 25, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants