How to use the Socket function from bindings

Find comprehensive JavaScript bindings.Socket code examples handpicked from public code repositorys.

98
99
100
101
102
103
104
105
106
      default:
          throw new Error('unrecognised socket type ' + type);
          break;
  }

this.binding = nn.Socket(this.af_domain, this.protocol);
this.bound = {};
this.connected = {};
this.queue = [];
fork icon993
star icon0
watch icon1

+ 33 other calls in file

49
50
51
52
53
54
55
56
57
58
    if(typeof opts == 'string') opts = { fam: opts }
    opts = opts || { fam: 'af' }
    if(!opts.hasOwnProperty('fam')) opts.fam = 'af'

    //ensure first nanomsg socket is not zero, else disregard it
    var nns = nn.Socket(af[opts.fam], sock[type][0])
    if(nns == 0) return new self(nn.Socket(af[opts.fam],sock[type][0]), type, opts)
    return new self( nns, type, opts )
  }
}
fork icon4
star icon10
watch icon7

+ 21 other calls in file

58
59
60
61
62
63
64
65
66
67
    //preflight check
    if(typeof opts == 'string') opts = { fam: opts }
    opts = opts || { fam: 'af' }
    if(!opts.hasOwnProperty('fam')) opts.fam = 'af'

    return new self( nn.Socket(af[opts.fam],sock[type]), type, opts)
  }
}

function self (s, t, o) {
fork icon4
star icon1
watch icon1

+ 19 other calls in file

Other functions in bindings

Sorted by popularity

function icon

bindings.createKey is the most popular function in bindings (8616 examples)