Search code examples
azurewebsocketportlivechat

How Can I open websocket port on azure?


I want to create live chatroom by BrainSocket.I follow from this tutorial ,and it's work well on my localhost.When i deploy on ubuntu 14.04 on azure virtual machine it not work. Chrome Inspect is tell me error on this part of my code

 app.BrainSocket = new BrainSocket(
                    new WebSocket('ws://myappname.cloudapp.net:8080'),
                    new BrainSocketPubSub()
            );

it's tell ws://myappname.cloudapp.net:8080 is return 404 not found... I guess it should be web socket port problem on Azure. How can I open web socket port 8080 on Azure virtual machine ?


Solution

  • You have to add an Endpoint to your virutal machine. Go to Management Portal/Your_VM/Endpoints and click add new. Your endpoint configuration should look similar to this:

    enter image description here

    Detailed instruction can be found here http://azure.microsoft.com/en-gb/documentation/articles/virtual-machines-set-up-endpoints/