Class Socket
- Defined in: index.js
Constructor Attributes | Constructor Name and Description |
---|---|
Socket(type)
Create a new socket of the given `type`.
|
Method Summary
Method Attributes | Method Name and Description |
---|---|
bind(addr, cb)
Async bind.
|
|
bindSync(addr)
Sync bind.
|
|
close()
Close the socket.
|
|
connect(addr)
Connect to `addr`.
|
|
getsockopt(opt)
Get socket `opt`.
|
|
send(msg, flags)
Send the given `msg`.
|
|
setsockopt(opt, val)
Set `opt` to `val`.
|
|
subscribe(filter)
Subscribe with the given `filter`.
|
|
unsubscribe(filter)
Unsubscribe with the given `filter`.
|
Class Detail
Socket(type)
Create a new socket of the given `type`.
- Parameters:
- {String|Number} type
Method Detail
-
{Socket} bind(addr, cb)Async bind. Emits the "bind" event.
- Parameters:
- {String} addr
- {Function} cb
- Returns:
- {Socket} for chaining
-
{Socket} bindSync(addr)Sync bind.
- Parameters:
- {String} addr
- Returns:
- {Socket} for chaining
-
{Socket} close()Close the socket.
- Returns:
- {Socket} for chaining
-
{Socket} connect(addr)Connect to `addr`.
- Parameters:
- {String} addr
- Returns:
- {Socket} for chaining
-
{Mixed} getsockopt(opt)Get socket `opt`.
- Parameters:
- {String|Number} opt
- Returns:
- {Mixed}
-
{Socket} send(msg, flags)Send the given `msg`.
- Parameters:
- {String|Buffer} msg
- {Number} flags
- Returns:
- {Socket} for chaining
-
{Socket} setsockopt(opt, val)Set `opt` to `val`.
- Parameters:
- {String|Number} opt
- {Mixed} val
- Returns:
- {Socket} for chaining
-
{Socket} subscribe(filter)Subscribe with the given `filter`.
- Parameters:
- {String} filter
- Returns:
- {Socket} for chaining
-
{Socket} unsubscribe(filter)Unsubscribe with the given `filter`.
- Parameters:
- {String} filter
- Returns:
- {Socket} for chaining