Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8985889
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T21:25:29+00:00 2026-06-15T21:25:29+00:00

I have a node application I am trying to host on Azure, that create

  • 0

I have a node application I am trying to host on Azure, that create a websocket server. I am trying to create the web socket server using the code below:

var socket = require('websocket').server;
...
server.listen(1111,function(){
   console.log('Http server is listening on port 1111');
});

When I do this on my local machine it works fine, but once it’s up on Azure the following line of client side javascript:

var connection = new WebSocket('ws:' + document.domain + ':1111');
connection.send(msg); //throws error

Throws the error:

InvalidStateError: An attempt was made to use an object that is not,
or is no longer, usable

Can I get the desired functionality if I’m using azure? If so, any suggestions on where to start looking for a fix?

You can see the broken app in action here.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T21:25:30+00:00Added an answer on June 15, 2026 at 9:25 pm

    It will work on Azure, but you need to make a change. Try this:

    server.listen(process.env.port, function () {
      var addr = app.address();
      console.log('Server listening on http://' + addr.address + ':' + addr.port);
    });
    

    Here’s a tutorial on using the chat example from Socket.IO’s source in Azure:

    http://www.windowsazure.com/en-us/develop/nodejs/tutorials/app-using-socketio/

    It assumes you’re on Windows, which isn’t strictly necessary. To use Node.js on Azure from a Mac or Linux system, just publish from Git:

    http://www.windowsazure.com/en-us/develop/nodejs/common-tasks/publishing-with-git/

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Trying to create a Sencha-Touch-2 app syncing to a Node.js server; code below. The
I have a node application that is not a web application - it completes
I use node.js and socket.io. I have an application that runs on the IP
I am pretty new to CoffeeScript. I am trying to create Node.js application using
I'm currently trying to access a private Trello board using a Node.js web application.
I'm trying to build a simple web application using Node.js and CouchDb. The application
I have a node.js (v0.6.12) application that starts by evaluating a Javascript file, startup.js.
Currently i have a node.js and socket.io application in development on my local machine
I have a 3-node web farm being managed by IIS7 and Application Request Routing.
I have a Node.js web server running on an embedded Linux system. For authentication

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.