How Can I open websocket port on azure?

2019-09-13 00:23发布

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 ?

1条回答
做个烂人
2楼-- · 2019-09-13 00:49

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/

查看更多
登录 后发表回答