@@ -57,7 +57,7 @@ const shortOptions = {
57
57
connect_timeout : longOptions . ZMQ_CONNECT_TIMEOUT ,
58
58
}
59
59
60
- class Context {
60
+ export class Context {
61
61
static setMaxThreads ( value : number ) {
62
62
zmq . context . ioThreads = value
63
63
}
@@ -79,7 +79,10 @@ class Context {
79
79
}
80
80
}
81
81
82
- type SocketType =
82
+ /**
83
+ * All the socket types available in the compatibility layer
84
+ */
85
+ export type SocketType =
83
86
| "pair"
84
87
| "req"
85
88
| "rep"
@@ -97,7 +100,7 @@ type SocketType =
97
100
98
101
type Callback = ( err ?: Error ) => void
99
102
100
- class Socket extends EventEmitter {
103
+ export class Socket extends EventEmitter {
101
104
[ key : string ] : any
102
105
103
106
type : SocketType
@@ -729,7 +732,7 @@ for (const key in shortOptions) {
729
732
} )
730
733
}
731
734
732
- function createSocket ( type : SocketType , options : { [ key : string ] : any } = { } ) {
735
+ export function createSocket ( type : SocketType , options : { [ key : string ] : any } = { } ) {
733
736
const sock = new Socket ( type )
734
737
for ( const key in options ) {
735
738
if ( options . hasOwnProperty ( key ) ) {
@@ -739,12 +742,12 @@ function createSocket(type: SocketType, options: {[key: string]: any} = {}) {
739
742
return sock
740
743
}
741
744
742
- function curveKeypair ( ) {
745
+ export function curveKeypair ( ) {
743
746
const { publicKey, secretKey} = zmq . curveKeyPair ( )
744
747
return { public : publicKey , secret : secretKey }
745
748
}
746
749
747
- function proxy ( frontend : Socket , backend : Socket , capture ?: Socket ) {
750
+ export function proxy ( frontend : Socket , backend : Socket , capture ?: Socket ) {
748
751
switch ( `${ frontend . type } /${ backend . type } ` ) {
749
752
case "push/pull" :
750
753
case "pull/push" :
@@ -790,17 +793,10 @@ function proxy(frontend: Socket, backend: Socket, capture?: Socket) {
790
793
}
791
794
}
792
795
793
- const version = zmq . version
796
+ export const version = zmq . version
794
797
795
798
export {
796
- version ,
797
- Context ,
798
- Socket ,
799
- SocketType ,
800
799
createSocket as socket ,
801
- createSocket ,
802
- curveKeypair ,
803
- proxy ,
804
800
shortOptions as options ,
805
801
}
806
802
0 commit comments