Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Close sio #1646

Merged
merged 6 commits into from Jul 1, 2014
Merged

Close sio #1646

merged 6 commits into from Jul 1, 2014

Conversation

narcisoguillen
Copy link

When creating a new Server with a port

var PORT = 3030;
var sio = require('socket.io')(PORT);

socket.io is creating a new http server https://github.com/Automattic/socket.io/blob/master/lib/index.js#L209 when only sending a PORT. This will allow to close this server

Currently

var PORT = 3030;
var sio = require('socket.io')(PORT);

sio.engine.close();

var sio = require('socket.io')(PORT);

  Error: listen EADDRINUSE

@Lordnibbler
Copy link

👍 for this fix, been missing the close() method in 1.0! :neckbeard:

@rauchg
Copy link
Contributor

rauchg commented Jun 24, 2014

Looks really good, thanks. Definitely needs tests

describe('close', function(){

it('should be able to close sio sending a srv', function(){
var PORT = 3030;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This could technically be used on someone's machine. We need to use ephemeral ports in tests.

rauchg added a commit that referenced this pull request Jul 1, 2014
@rauchg rauchg merged commit c18ed5f into socketio:master Jul 1, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants