Get Even More Visitors To Your Blog, Upgrade To A Business Listing >>

running Hook.io on a different port

running Hook.io on a different port

Problem

I tried to run hook.io with a different Port, which killed the autodiscover features of the clients. But when I try to create the clients with the same port, they get an error.

Sever:

var oHook = hookio.createHook( {
  'name'     :'dispatch-hook',
  'hook-port': 9999,
  'hook-host': 'localhost'
} );

oHook.start();

Client:

var oHook = hookio.createHook( {
  name       :'client-hook',
  "hook-port":9999,
  "hook-host":'localhost'
});

oHook.connect();

Error:

events.js:66
    throw arguments[1]; // Unhandled 'error' event
                   ^
Error: listen EADDRINUSE
    at errnoException (net.js:781:11)
    at Server._listen2._connectionKey (net.js:922:26)
    at process.startup.processNextTick.process._tickCallback (node.js:244:9)

Why does the client want to start a server?

Problem courtesy of: K..

Solution

You shouldn't provide a port for the hook trying to connect to the server hook. The existence of hook-port in options makes that hook a server

Solution courtesy of: Pavan Kumar Sunkara

Discussion

View additional discussion.



This post first appeared on Node.js Recipes, please read the originial post: here

Share the post

running Hook.io on a different port

×

Subscribe to Node.js Recipes

Get updates delivered right to your inbox!

Thank you for your subscription

×