Last active
May 23, 2017 09:14
-
-
Save atsu85/346b8794bf5d8b27772c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Author: Ats Uiboupin, see https://github.com/jmesnil/stomp-websocket/issues/61 | |
* it is possible to use other type of WebSockets by using the Stomp.over(ws) method. This method expects an object that conforms to the WebSocket definition. | |
* TODO specifi minimal required object structure, see SockJS as an acceptable example: https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/sockjs/sockjs.d.ts#L23 | |
*/ | |
declare type StompMinimalWebSocketDefinition = any; | |
declare type StompWebSocketDefinition = WebSocket | StompMinimalWebSocketDefinition | SockJS; | |
declare type StompHeaders = { [key: string ]: string;}; | |
declare type StompSubscriptions = { [key: string ]: string;}; | |
declare type StompFrameCallback = (frame: StompFrame) => void; | |
interface StompFrame { | |
command: string; | |
headers: StompHeaders; | |
body?: string; | |
} | |
interface StompStatic { | |
over(webSocket: StompWebSocketDefinition): StompClient; | |
} | |
interface StompSubscription { | |
id: any; | |
unsubscribe: () => void; | |
} | |
interface HeartBeatConfig { | |
incoming : number; | |
outgoing : number; | |
} | |
interface StompClient { | |
/* START: object internals, maybe not for public use | |
connectCallback: StompFrameCallback; | |
connected: boolean; | |
counter: number; | |
maxWebSocketFrameSize: number; | |
partialData: string; | |
serverActivity: number; | |
subscriptions: { [key: string ]: StompFrameCallback;}; | |
ws: StompMinimalWebSocketDefinition; | |
*/ | |
debug: (msg: string) => void; | |
heartbeat : HeartBeatConfig; | |
connect(login: string, passcode: string, connectCallback?: () => void, errorCallback?: () => void, host?: string); | |
connect(headers: StompHeaders, connectCallback?: StompFrameCallback, errorCallback?: StompFrameCallback); | |
subscribe(destination: string, callback: (stompFrame: StompFrame, headers?: StompHeaders) => void): StompSubscription; | |
disconnect(disconnectCallback?: () => void); | |
} | |
declare var Stomp: StompStatic; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment