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

  • SEARCH
  • Home
  • 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 8727781
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T08:30:09+00:00 2026-06-13T08:30:09+00:00

I use node.js and socket.io to create a real time web application. I will

  • 0

I use node.js and socket.io to create a real time web application. I will give the users full control of the socket connection, like manual disconnect and (re)connect.

function socket_connect()
{
    console.log('func socket_connect');
    socket = io.connect('http://url/to/the/app');
}

function socket_reconnect()
{
    console.log('func socket_reconnect');
    socket_connect();
}

function socket_disconnect ()
{
    console.log('func socket_disconnect');
    if (socket) socket.disconnect();
}

On client start up the socket_connect() function works fine, but after using socket.disconnect(), no new connection starts.

  • 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-13T08:30:10+00:00Added an answer on June 13, 2026 at 8:30 am

    It works now, with socket.socket.reconnect()

    function socket_connect()
    {
        console.log('func socket_connect');
        socket = io.connect('http://url/to/the/app');
    }
    
    function socket_reconnect()
    {
        console.log('func socket_reconnect');
        socket.socket.reconnect();
    }
    
    function socket_disconnect ()
    {
        console.log('func socket_disconnect');
        if (socket) socket.disconnect();
    }
    

    Related: https://github.com/LearnBoost/socket.io-client/issues/251

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

Sidebar

Related Questions

I am using a node.js server to create a 'close to real-time' socket between
I use node.js and socket.io. I have an application that runs on the IP
What frameworks to use to develop dynamic web application with node.js and what books
I use the node.js and socket.io. My application runs on the port 3000. The
In node.js I'd like to create a client that: open a socket to server1
I'm using Node.JS and Socket.IO to create a chat, I use XHR polling with
I use node.js and socket.io. When I refresh the page - the user connection
I'm trying to use Node.js to create a zip file from an existing folder,
We'd like to use Winston for our logging in Node.js. But, we can't figure
I have a node.js/socket.io server and I wanted to create an Android app to

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.