starpc 0.10.2 → 0.10.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/srpc/server.d.ts +2 -1
- package/dist/srpc/server.js +5 -0
- package/package.json +1 -1
- package/srpc/server.ts +19 -1
package/dist/srpc/server.d.ts
CHANGED
|
@@ -12,7 +12,8 @@ export declare class Server implements StreamHandler {
|
|
|
12
12
|
get rpcStreamHandler(): RpcStreamHandler;
|
|
13
13
|
startRpc(): ServerRPC;
|
|
14
14
|
handleStream(stream: Stream): ServerRPC;
|
|
15
|
-
handleDuplex(stream: Duplex<Uint8ArrayList, Uint8ArrayList | Uint8Array>): ServerRPC;
|
|
15
|
+
handleDuplex(stream: Duplex<Uint8ArrayList | Uint8Array, Uint8ArrayList | Uint8Array>): ServerRPC;
|
|
16
|
+
handleUint8ArrayDuplex(stream: Duplex<Uint8Array>): ServerRPC;
|
|
16
17
|
handlePacketDuplex(stream: Duplex<Uint8Array>): ServerRPC;
|
|
17
18
|
handlePacketStream(stream: Duplex<Packet>): ServerRPC;
|
|
18
19
|
}
|
package/dist/srpc/server.js
CHANGED
|
@@ -26,6 +26,11 @@ export class Server {
|
|
|
26
26
|
pipe(stream, parseLengthPrefixTransform(), combineUint8ArrayListTransform(), decodePacketSource, rpc, encodePacketSource, prependLengthPrefixTransform(), stream);
|
|
27
27
|
return rpc;
|
|
28
28
|
}
|
|
29
|
+
handleUint8ArrayDuplex(stream) {
|
|
30
|
+
const rpc = this.startRpc();
|
|
31
|
+
pipe(stream, parseLengthPrefixTransform(), combineUint8ArrayListTransform(), decodePacketSource, rpc, encodePacketSource, prependLengthPrefixTransform(), combineUint8ArrayListTransform(), stream);
|
|
32
|
+
return rpc;
|
|
33
|
+
}
|
|
29
34
|
// handlePacketDuplex handles an incoming Uint8Array duplex.
|
|
30
35
|
// skips the packet length prefix transform.
|
|
31
36
|
handlePacketDuplex(stream) {
|
package/package.json
CHANGED
package/srpc/server.ts
CHANGED
|
@@ -43,7 +43,7 @@ export class Server implements StreamHandler {
|
|
|
43
43
|
|
|
44
44
|
// handleDuplex handles an incoming message duplex.
|
|
45
45
|
public handleDuplex(
|
|
46
|
-
stream: Duplex<Uint8ArrayList, Uint8ArrayList | Uint8Array>
|
|
46
|
+
stream: Duplex<Uint8ArrayList | Uint8Array, Uint8ArrayList | Uint8Array>
|
|
47
47
|
): ServerRPC {
|
|
48
48
|
const rpc = this.startRpc()
|
|
49
49
|
pipe(
|
|
@@ -59,6 +59,24 @@ export class Server implements StreamHandler {
|
|
|
59
59
|
return rpc
|
|
60
60
|
}
|
|
61
61
|
|
|
62
|
+
public handleUint8ArrayDuplex(
|
|
63
|
+
stream: Duplex<Uint8Array>
|
|
64
|
+
): ServerRPC {
|
|
65
|
+
const rpc = this.startRpc()
|
|
66
|
+
pipe(
|
|
67
|
+
stream,
|
|
68
|
+
parseLengthPrefixTransform(),
|
|
69
|
+
combineUint8ArrayListTransform(),
|
|
70
|
+
decodePacketSource,
|
|
71
|
+
rpc,
|
|
72
|
+
encodePacketSource,
|
|
73
|
+
prependLengthPrefixTransform(),
|
|
74
|
+
combineUint8ArrayListTransform(),
|
|
75
|
+
stream
|
|
76
|
+
)
|
|
77
|
+
return rpc
|
|
78
|
+
}
|
|
79
|
+
|
|
62
80
|
// handlePacketDuplex handles an incoming Uint8Array duplex.
|
|
63
81
|
// skips the packet length prefix transform.
|
|
64
82
|
public handlePacketDuplex(stream: Duplex<Uint8Array>): ServerRPC {
|