68750

How Can I open websocket port on azure?

Question:

I want to create live chatroom by <a href="https://github.com/BrainBoxLabs/brain-socket" rel="nofollow">BrainSocket</a>.I follow from <a href="https://xuri.me/2014/09/08/laravel-4-real-time-chat.html" rel="nofollow">this tutorial</a> ,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 ?

Answer1:

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:

<img alt="enter image description here" class="b-lazy" data-src="https://i.stack.imgur.com/oE06H.png" data-original="https://i.stack.imgur.com/oE06H.png" src="https://etrip.eimg.top/images/2019/05/07/timg.gif" />

Detailed instruction can be found here <a href="http://azure.microsoft.com/en-gb/documentation/articles/virtual-machines-set-up-endpoints/" rel="nofollow">http://azure.microsoft.com/en-gb/documentation/articles/virtual-machines-set-up-endpoints/</a>

Recommend

  • Spring WebSockets XML configuration not providing brokerMessagingTemplate
  • Converting JsonNode to java array
  • Socket.io takes a long time before triggering the disconnect event
  • Creating grails binary plugin results in jar file wich contains all groovy files with comments
  • Java NoClassDefFoundError when running jar containing library jar
  • How can I see Python's __builtins__ source code?
  • Cannot send user message with Spring Websocket
  • Returning this from a constructor function in JS
  • Cursor in wrong place in contenteditable
  • How does ActiveSupport do month sums?
  • Client side validation mvc dropdown
  • Cordova Apache wrong module path
  • Prolog Ambiguous Output
  • Separate ID and Class for JS and CSS
  • netsh acl setting (need alternative method - registry settings?)
  • how to set variables in a php include file?
  • Is playing sound in Javascript performance heavy?
  • Chrome doesn't support silverlight anymore? How to solve this?
  • Recording logins for password protected directories
  • Ajax jQuery multiple calls at the same time - long wait for answer and not able to cancel
  • What is Eclipse's Declaration View used for?
  • req.body is undefined - nodejs
  • Javascript convert timezone issue
  • Symfony2: How to get request parameter
  • Jquery - Jquery Wysiwyg return html as a string
  • Akka Routing: Reply's send to router ends up as dead letters
  • SVN: Merging two branches together
  • Is there a mandatory requirement to switch app.yaml?
  • Acquiring multiple attributes from .xml file in c#
  • Hits per day in Google Big Query
  • FormattedException instead of throw new Exception(string.Format(…)) in .NET
  • How to CLICK on IE download dialog box i.e.(Open, Save, Save As…)
  • Exception on Android 4.0 `android.os.StrictMode$AndroidBlockGuardPolicy.onNetwork(StrictMode)`
  • Linking SubReports Without LinkChild/LinkMaster
  • How can I remove ASP.NET Designer.cs files?
  • Append folder name and increment by 1 using batch script
  • XCode 8, some methods disappeared ? ex: layoutAttributesClass() -> AnyClass
  • How can I use `wmic` in a Windows PE script?
  • java string with new operator and a literal
  • How to push additional view controllers onto NavigationController but keep the TabBar?