Skip to content

Commit 5e092f7

Browse files
committed
docs: add DgramSocket docs
1 parent ba88e64 commit 5e092f7

File tree

8 files changed

+111
-57
lines changed

8 files changed

+111
-57
lines changed

README.md

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
# unix-socket
22

3+
## API Documents
34

4-
## TODO
5-
6-
- mark that server don't work with cluster module
5+
[API Documents](./docs/modules.md)

docs/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@ unix-socket / [Exports](modules.md)
22

33
# unix-socket
44

5-
## TODO
5+
## API Documents
66

7-
- mark that server don't work with cluster module
7+
[API Documents](./docs/modules.md)

docs/classes/DgramSocket.md

Lines changed: 41 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,24 @@
22

33
# Class: DgramSocket
44

5-
DgramSocket docs
5+
DgramSocket is used to create a SOCK_DGRAM unix domain socket.
6+
Currently DgramSocket doesn't work with `cluster` module.
7+
8+
DgramSocket is also an `EventEmitter` and will emit events including:
9+
10+
### Event: `'data'`
11+
- buffer `Buffer`
12+
- path `string`
13+
14+
Emitted when data is received. `path` indicates remote address information.
15+
16+
### Event: `'error'`
17+
- error `Error`
18+
19+
Emitted when an error occurs.
20+
21+
### Event: `'close'`
22+
The 'close' event is emitted after a socket is closed with close().
623

724
## Hierarchy
825

@@ -39,32 +56,31 @@ EventEmitter.constructor
3956

4057
#### Defined in
4158

42-
dgram.ts:30
59+
dgram.ts:46
4360

4461
## Methods
4562

4663
### address
4764

4865
**address**(): `string`
4966

67+
Returns the bound address.
68+
5069
#### Returns
5170

5271
`string`
5372

5473
#### Defined in
5574

56-
dgram.ts:107
75+
dgram.ts:135
5776

5877
___
5978

6079
### bind
6180

6281
**bind**(`socketPath`): `void`
6382

64-
Returns the average of two numbers.
65-
66-
**`remarks`**
67-
This method is part of the {@link core-library#Statistics | Statistics subsystem}.
83+
Listen for datagram messages on a path.
6884

6985
#### Parameters
7086

@@ -76,25 +92,25 @@ This method is part of the {@link core-library#Statistics | Statistics subsystem
7692

7793
`void`
7894

79-
The arithmetic mean of `x` and `y`
80-
8195
#### Defined in
8296

83-
dgram.ts:67
97+
dgram.ts:75
8498

8599
___
86100

87101
### close
88102

89103
**close**(): `void`
90104

105+
Close the underlying socket and stop listening for data on it.
106+
91107
#### Returns
92108

93109
`void`
94110

95111
#### Defined in
96112

97-
dgram.ts:111
113+
dgram.ts:143
98114

99115
___
100116

@@ -106,9 +122,11 @@ ___
106122

107123
`number`
108124

125+
the SO_RCVBUF socket receive buffer size in bytes.
126+
109127
#### Defined in
110128

111-
dgram.ts:91
129+
dgram.ts:102
112130

113131
___
114132

@@ -120,17 +138,19 @@ ___
120138

121139
`number`
122140

141+
the SO_SNDBUF socket send buffer size in bytes.
142+
123143
#### Defined in
124144

125-
dgram.ts:99
145+
dgram.ts:118
126146

127147
___
128148

129149
### sendTo
130150

131151
**sendTo**(`buf`, `offset`, `length`, `destPath`, `onWrite?`): `void`
132152

133-
TODO sendTo
153+
Send messages to the destination path.
134154

135155
#### Parameters
136156

@@ -148,14 +168,16 @@ TODO sendTo
148168

149169
#### Defined in
150170

151-
dgram.ts:80
171+
dgram.ts:88
152172

153173
___
154174

155175
### setRecvBufferSize
156176

157177
**setRecvBufferSize**(`size`): `void`
158178

179+
Sets the SO_RCVBUF socket option. Sets the maximum socket receive buffer in bytes.
180+
159181
#### Parameters
160182

161183
| Name | Type |
@@ -168,14 +190,16 @@ ___
168190

169191
#### Defined in
170192

171-
dgram.ts:95
193+
dgram.ts:111
172194

173195
___
174196

175197
### setSendBufferSize
176198

177199
**setSendBufferSize**(`size`): `void`
178200

201+
Sets the SO_SNDBUF socket option. Sets the maximum socket send buffer in bytes.
202+
179203
#### Parameters
180204

181205
| Name | Type |
@@ -188,4 +212,4 @@ ___
188212

189213
#### Defined in
190214

191-
dgram.ts:103
215+
dgram.ts:127

docs/classes/SeqpacketServer.md

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22

33
# Class: SeqpacketServer
44

5-
SeqpacketServer is used to create a SOCK_SEQPACKET server. SeqpacketServer doesn't works on MacOS.
5+
SeqpacketServer is used to create a SOCK_SEQPACKET server.
6+
Note that sockets of SOCK_SEQPACKET don't works on MacOS and currently SeqpacketServer doesn't work with `cluster` module, i.e. you can share a SeqpacketServer across different Node.js processes.
67

78
SeqpacketServer is also an `EventEmitter` and will emit events including:
89

@@ -53,7 +54,7 @@ EventEmitter.constructor
5354

5455
#### Defined in
5556

56-
seqpacket.ts:47
57+
seqpacket.ts:48
5758

5859
## Methods
5960

@@ -69,7 +70,7 @@ Returns the bound address.
6970

7071
#### Defined in
7172

72-
seqpacket.ts:74
73+
seqpacket.ts:75
7374

7475
___
7576

@@ -87,7 +88,7 @@ This function is synchronous.
8788

8889
#### Defined in
8990

90-
seqpacket.ts:85
91+
seqpacket.ts:86
9192

9293
___
9394

@@ -110,7 +111,7 @@ Start a server listening for connections on the given path. This function is syn
110111

111112
#### Defined in
112113

113-
seqpacket.ts:98
114+
seqpacket.ts:99
114115

115116
___
116117

@@ -126,7 +127,7 @@ Reference the server so that it will prevent Node.js process from exiting automa
126127

127128
#### Defined in
128129

129-
seqpacket.ts:106
130+
seqpacket.ts:107
130131

131132
___
132133

@@ -142,4 +143,4 @@ Unreference the server so that it won't prevent Node.js process from exiting aut
142143

143144
#### Defined in
144145

145-
seqpacket.ts:113
146+
seqpacket.ts:114

docs/classes/SeqpacketSocket.md

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ EventEmitter.constructor
6666

6767
#### Defined in
6868

69-
seqpacket.ts:147
69+
seqpacket.ts:148
7070

7171
## Methods
7272

@@ -92,7 +92,7 @@ However, connect() will throw error synchronously if the 'serverPath' is not a v
9292

9393
#### Defined in
9494

95-
seqpacket.ts:209
95+
seqpacket.ts:210
9696

9797
___
9898

@@ -108,7 +108,7 @@ Ensures that no more I/O activity happens on this socket. Destroys the stream an
108108

109109
#### Defined in
110110

111-
seqpacket.ts:272
111+
seqpacket.ts:273
112112

113113
___
114114

@@ -130,7 +130,7 @@ Half-closes the socket. i.e., it sends a FIN packet. It is possible the server w
130130

131131
#### Defined in
132132

133-
seqpacket.ts:231
133+
seqpacket.ts:232
134134

135135
___
136136

@@ -148,7 +148,7 @@ Default size is 256KB.
148148

149149
#### Defined in
150150

151-
seqpacket.ts:242
151+
seqpacket.ts:243
152152

153153
___
154154

@@ -164,7 +164,7 @@ Reference the socket so that it will prevent Node.js process from exiting automa
164164

165165
#### Defined in
166166

167-
seqpacket.ts:258
167+
seqpacket.ts:259
168168

169169
___
170170

@@ -186,7 +186,7 @@ Set the size of buffer that SeqpacketSocket uses to receive data.
186186

187187
#### Defined in
188188

189-
seqpacket.ts:251
189+
seqpacket.ts:252
190190

191191
___
192192

@@ -202,7 +202,7 @@ Unreference the socket so that it won't prevent Node.js process from exiting aut
202202

203203
#### Defined in
204204

205-
seqpacket.ts:265
205+
seqpacket.ts:266
206206

207207
___
208208

@@ -227,4 +227,4 @@ Sends data on the socket.
227227

228228
#### Defined in
229229

230-
seqpacket.ts:222
230+
seqpacket.ts:223

0 commit comments

Comments
 (0)