JDare / ClankBundle

A Symfony2 Bundle for use with Ratchet WebSocket Server
MIT License
131 stars 31 forks source link

Problem at connection #26

Closed asennoussi closed 10 years ago

asennoussi commented 10 years ago

I'm using clank bundle and I want to test if socket server is running without problem I have set the configuration as follow :

# Clank Configuration
clank:
    web_socket_server:
        port: 8080        #The port the socket server will listen on
        host: domain.com #(optional) The host ip to bind to

the port 8080 is open and tested after adding the two js files : autobahn.min.js and clank.js I do the following :

var myClank = Clank.connect("wss://domain.com:8080"); // I use SSL

        myClank.on("socket/connect", function(session){
            //session is an Autobahn JS WAMP session.

            console.log("Successfully Connected!");
        })

        myClank.on("socket/disconnect", function(error){
            //error provides us with some insight into the disconnection: error.reason and error.code

            console.log("Disconnected for " + error.reason + " with code " + error.code);
        })

note that the server is already running with the command :

php app/console clank:server

the problem is I can't get the success message in my console.. When I stop clank server , it outputs the failure message. I don't know what's happening please help me ..

asennoussi commented 10 years ago

I'm running it on nginx if that can add anything

alcalyn commented 10 years ago

You wrote: var myClank = Clank.connect("wss://domain.com:8080"); // I use SSL

Should'nt it be: var myClank = Clank.connect("ws://domain.com:8080"); // I use SSL ?

ws:// instead of wss://

asennoussi commented 10 years ago

Hey! No, it's wss for secured connection, it won't work on Firefox otherwise. You can do it via proxy

alcalyn commented 10 years ago

Maybe your proxy don't accept websockets. Try without proxy

asennoussi commented 10 years ago

I don't know if you're asking or trying to solve the problem. Because I solved the problem by using a proxy on nginx. and this issue can be closed

amcastror commented 8 years ago

Hi @Sshuichi , do you know how to do this same thing but with apache2? Thanks a lot!

asennoussi commented 8 years ago

This mod should answer your need : https://httpd.apache.org/docs/2.4/mod/mod_proxy_wstunnel.html

amcastror commented 8 years ago

Thans a lot, I'll do that.

amcastror commented 8 years ago

It work's! Thanks a lot.