@stomp/stompjs 6.0.0 → 6.1.0

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.
@@ -1 +1 @@
1
- {"version":3,"sources":["webpack://StompJs/webpack/universalModuleDefinition","webpack://StompJs/webpack/bootstrap","webpack://StompJs/./src/byte.ts","webpack://StompJs/./src/frame-impl.ts","webpack://StompJs/./src/parser.ts","webpack://StompJs/./src/types.ts","webpack://StompJs/./src/versions.ts","webpack://StompJs/./src/stomp-handler.ts","webpack://StompJs/./src/augment-websocket.ts","webpack://StompJs/./src/client.ts","webpack://StompJs/./src/stomp-config.ts","webpack://StompJs/./src/stomp-headers.ts","webpack://StompJs/./src/stomp-subscription.ts","webpack://StompJs/./src/compatibility/heartbeat-info.ts","webpack://StompJs/./src/compatibility/compat-client.ts","webpack://StompJs/./src/compatibility/stomp.ts"],"names":["root","factory","exports","module","define","amd","self","this","installedModules","__webpack_require__","moduleId","i","l","modules","call","m","c","d","name","getter","o","Object","defineProperty","enumerable","get","r","Symbol","toStringTag","value","t","mode","__esModule","ns","create","key","bind","n","object","property","prototype","hasOwnProperty","p","s","BYTE","params","command","headers","body","binaryBody","escapeHeaderValues","skipContentLengthHeader","assign","_binaryBody","isBinaryBody","_body","TextDecoder","decode","TextEncoder","encode","rawFrame","trim","str","replace","header","reverse","indexOf","hdrValueUnEscape","serializeCmdAndHeaders","cmdAndHeaders","toUnit8Array","buffer","lines","keys","push","hdrValueEscape","isBodyEmpty","bodyLength","join","length","uint8CmdAndHeaders","nullTerminator","Uint8Array","uint8Frame","set","serialize","Parser","onFrame","onIncomingPing","_encoder","_decoder","_token","_initState","segment","appendMissingNULLonIncoming","chunk","ArrayBuffer","chunkWithNull","byte","_onByte","_collectCommand","_reinjectByte","_results","_consumeTokenAsUTF8","_collectHeaders","_consumeByte","_collectHeaderKey","_setupCollectBody","_headerKey","_collectHeaderValue","undefined","contentLengthHeader","filter","_bodyBytesRemaining","parseInt","_collectBodyFixedSize","_collectBodyNullTerminated","_retrievedBody","_consumeTokenAsRaw","rawResult","_collectFrame","StompSocketState","ActivationState","Versions","versions","map","x","V1_0","V1_1","V1_2","default","_client","_webSocket","config","_serverFrameHandlers","CONNECTED","frame","debug","server","_connected","_connectedVersion","version","_escapeHeaderValues","_setupHeartbeat","onConnect","MESSAGE","subscription","onReceive","_subscriptions","onUnhandledMessage","message","client","messageId","ack","nack","RECEIPT","callback","_receiptWatchers","onUnhandledReceipt","ERROR","onStompError","_counter","_partialData","_lastServerActivityTS","Date","now","configure","conf","parser","fromRawFrame","logRawCommunication","onUnhandledFrame","onmessage","evt","rawChunkAsString","data","parseChunk","_onclose","closeEvent","brokerURL","_cleanUp","onWebSocketClose","onclose","onerror","errorEvent","onWebSocketError","onopen","connectHeaders","stompVersions","supportedVersions","heartbeatOutgoing","heartbeatIncoming","_transmit","serverOutgoing","serverIncoming","split","v","ttl","Math","max","_pinger","setInterval","readyState","OPEN","send","_ponger","delta","_closeOrDiscardWebsocket","discardWebsocketOnCommFailure","_discardWebsocket","_closeWebsocket","CONNECTING","close","webSocket","terminate","msg","noOp","ts","origOnClose","delay","getTime","code","reason","wasClean","rawChunk","forceBinaryWSFrames","splitLargeFrames","out","substring","maxWebSocketChunkSize","connected","disconnectHeaders","receipt","watchForReceipt","onDisconnect","error","clearInterval","destination","hdrs","receiptId","id","unsubscribe","transactionId","txId","transaction","commit","abort","subscriptionId","connectionTimeout","reconnectDelay","state","INACTIVE","beforeConnect","onChangeState","_disconnectHeaders","_stompHandler","connectedVersion","ACTIVE","DEACTIVATING","Error","active","_changeState","_connect","_connectionWatcher","setTimeout","forceDisconnect","_createWebSocket","clearTimeout","_disposeStompHandler","_resolveSocketClose","_schedule_reconnect","start","webSocketFactory","WebSocket","protocolVersions","binaryType","_reconnector","retPromise","Promise","resolve","CLOSED","reject","dispose","publish","subscribe","begin","StompConfig","StompHeaders","StompSubscription","HeartbeatInfo","super","maxWebSocketFrameSize","_heartbeatInfo","reconnect_delay","console","log","args","closeEventCallback","connectCallback","errorCallback","login","passcode","host","_parseConnect","activate","disconnectCallback","deactivate","incoming","outgoing","url","protocols","WebSocketClass","ws","wsFn","warn"],"mappings":"CAAA,SAA2CA,EAAMC,GAC1B,iBAAZC,SAA0C,iBAAXC,OACxCA,OAAOD,QAAUD,IACQ,mBAAXG,QAAyBA,OAAOC,IAC9CD,OAAO,UAAW,GAAIH,GACI,iBAAZC,QACdA,QAAiB,QAAID,IAErBD,EAAc,QAAIC,IARpB,CASmB,oBAATK,KAAuBA,KAAOC,MAAM,WAC9C,O,YCTE,IAAIC,EAAmB,GAGvB,SAASC,EAAoBC,GAG5B,GAAGF,EAAiBE,GACnB,OAAOF,EAAiBE,GAAUR,QAGnC,IAAIC,EAASK,EAAiBE,GAAY,CACzCC,EAAGD,EACHE,GAAG,EACHV,QAAS,IAUV,OANAW,EAAQH,GAAUI,KAAKX,EAAOD,QAASC,EAAQA,EAAOD,QAASO,GAG/DN,EAAOS,GAAI,EAGJT,EAAOD,QA0Df,OArDAO,EAAoBM,EAAIF,EAGxBJ,EAAoBO,EAAIR,EAGxBC,EAAoBQ,EAAI,SAASf,EAASgB,EAAMC,GAC3CV,EAAoBW,EAAElB,EAASgB,IAClCG,OAAOC,eAAepB,EAASgB,EAAM,CAAEK,YAAY,EAAMC,IAAKL,KAKhEV,EAAoBgB,EAAI,SAASvB,GACX,oBAAXwB,QAA0BA,OAAOC,aAC1CN,OAAOC,eAAepB,EAASwB,OAAOC,YAAa,CAAEC,MAAO,WAE7DP,OAAOC,eAAepB,EAAS,aAAc,CAAE0B,OAAO,KAQvDnB,EAAoBoB,EAAI,SAASD,EAAOE,GAEvC,GADU,EAAPA,IAAUF,EAAQnB,EAAoBmB,IAC/B,EAAPE,EAAU,OAAOF,EACpB,GAAW,EAAPE,GAA8B,iBAAVF,GAAsBA,GAASA,EAAMG,WAAY,OAAOH,EAChF,IAAII,EAAKX,OAAOY,OAAO,MAGvB,GAFAxB,EAAoBgB,EA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B3S,KAAKsL,kBAAoBjK,EAAMuR,UCrP5B,MAAM,EAmCJ,cAAcC,EAAaC,GAcf,MAAbA,IACFA,EAAY3L,EAASO,QAAQgJ,oBAO/B,OAAO,IAAI,EALE,IAEJ,IADO,EAAMqC,gBAAkBtC,WACrBoC,EAAKC,IA2BnB,YAAYE,GACjB,IAAIC,EAYJ,MAVkB,mBAAPD,EACTC,EAAOD,GAEPlB,QAAQoB,KACN,qJAGFD,EAAO,IAAMD,GAGR,IAAI,EAAaC,IA3EZ,EAAAF,eAAsB","file":"stomp.umd.min.js","sourcesContent":["(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory();\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine(\"StompJs\", [], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"StompJs\"] = factory();\n\telse\n\t\troot[\"StompJs\"] = factory();\n})(typeof self !== 'undefined' ? self : this, function() {\nreturn "," \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, { enumerable: true, get: getter });\n \t\t}\n \t};\n\n \t// define __esModule on exports\n \t__webpack_require__.r = function(exports) {\n \t\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n \t\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n \t\t}\n \t\tObject.defineProperty(exports, '__esModule', { value: true });\n \t};\n\n \t// create a fake namespace object\n \t// mode & 1: value is a module id, require it\n \t// mode & 2: merge all properties of value into the ns\n \t// mode & 4: return value when already ns object\n \t// mode & 8|1: behave like require\n \t__webpack_require__.t = function(value, mode) {\n \t\tif(mode & 1) value = __webpack_require__(value);\n \t\tif(mode & 8) return value;\n \t\tif((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;\n \t\tvar ns = Object.create(null);\n \t\t__webpack_require__.r(ns);\n \t\tObject.defineProperty(ns, 'default', { enumerable: true, value: value });\n \t\tif(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));\n \t\treturn ns;\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 0);\n","/**\n * Some byte values, used as per STOMP specifications.\n *\n * Part of `@stomp/stompjs`.\n *\n * @internal\n */\nexport const BYTE = {\n // LINEFEED byte (octet 10)\n LF: '\\x0A',\n // NULL byte (octet 0)\n NULL: '\\x00',\n};\n","import { BYTE } from './byte';\nimport { IFrame } from './i-frame';\nimport { StompHeaders } from './stomp-headers';\nimport { IRawFrameType } from './types';\n\n/**\n * Frame class represents a STOMP frame.\n *\n * @internal\n */\nexport class FrameImpl implements IFrame {\n /**\n * STOMP Command\n */\n public command: string;\n\n /**\n * Headers, key value pairs.\n */\n public headers: StompHeaders;\n\n /**\n * Is this frame binary (based on whether body/binaryBody was passed when creating this frame).\n */\n public isBinaryBody: boolean;\n\n /**\n * body of the frame\n */\n get body(): string {\n if (!this._body && this.isBinaryBody) {\n this._body = new TextDecoder().decode(this._binaryBody);\n }\n return this._body;\n }\n private _body: string;\n\n /**\n * body as Uint8Array\n */\n get binaryBody(): Uint8Array {\n if (!this._binaryBody && !this.isBinaryBody) {\n this._binaryBody = new TextEncoder().encode(this._body);\n }\n return this._binaryBody;\n }\n private _binaryBody: Uint8Array;\n\n private escapeHeaderValues: boolean;\n private skipContentLengthHeader: boolean;\n\n /**\n * Frame constructor. `command`, `headers` and `body` are available as properties.\n *\n * @internal\n */\n constructor(params: {\n command: string;\n headers?: StompHeaders;\n body?: string;\n binaryBody?: Uint8Array;\n escapeHeaderValues?: boolean;\n skipContentLengthHeader?: boolean;\n }) {\n const {\n command,\n headers,\n body,\n binaryBody,\n escapeHeaderValues,\n skipContentLengthHeader,\n } = params;\n this.command = command;\n this.headers = (Object as any).assign({}, headers || {});\n\n if (binaryBody) {\n this._binaryBody = binaryBody;\n this.isBinaryBody = true;\n } else {\n this._body = body || '';\n this.isBinaryBody = false;\n }\n this.escapeHeaderValues = escapeHeaderValues || false;\n this.skipContentLengthHeader = skipContentLengthHeader || false;\n }\n\n /**\n * deserialize a STOMP Frame from raw data.\n *\n * @internal\n */\n public static fromRawFrame(\n rawFrame: IRawFrameType,\n escapeHeaderValues: boolean\n ): FrameImpl {\n const headers: StompHeaders = {};\n const trim = (str: string): string => str.replace(/^\\s+|\\s+$/g, '');\n\n // In case of repeated headers, as per standards, first value need to be used\n for (const header of rawFrame.headers.reverse()) {\n const idx = header.indexOf(':');\n\n const key = trim(header[0]);\n let value = trim(header[1]);\n\n if (\n escapeHeaderValues &&\n rawFrame.command !== 'CONNECT' &&\n rawFrame.command !== 'CONNECTED'\n ) {\n value = FrameImpl.hdrValueUnEscape(value);\n }\n\n headers[key] = value;\n }\n\n return new FrameImpl({\n command: rawFrame.command,\n headers,\n binaryBody: rawFrame.binaryBody,\n escapeHeaderValues,\n });\n }\n\n /**\n * @internal\n */\n public toString(): string {\n return this.serializeCmdAndHeaders();\n }\n\n /**\n * serialize this Frame in a format suitable to be passed to WebSocket.\n * If the body is string the output will be string.\n * If the body is binary (i.e. of type Unit8Array) it will be serialized to ArrayBuffer.\n *\n * @internal\n */\n public serialize(): string | ArrayBuffer {\n const cmdAndHeaders = this.serializeCmdAndHeaders();\n\n if (this.isBinaryBody) {\n return FrameImpl.toUnit8Array(cmdAndHeaders, this._binaryBody).buffer;\n } else {\n return cmdAndHeaders + this._body + BYTE.NULL;\n }\n }\n\n private serializeCmdAndHeaders(): string {\n const lines = [this.command];\n if (this.skipContentLengthHeader) {\n delete this.headers['content-length'];\n }\n\n for (const name of Object.keys(this.headers || {})) {\n const value = this.headers[name];\n if (\n this.escapeHeaderValues &&\n this.command !== 'CONNECT' &&\n this.command !== 'CONNECTED'\n ) {\n lines.push(`${name}:${FrameImpl.hdrValueEscape(`${value}`)}`);\n } else {\n lines.push(`${name}:${value}`);\n }\n }\n if (\n this.isBinaryBody ||\n (!this.isBodyEmpty() && !this.skipContentLengthHeader)\n ) {\n lines.push(`content-length:${this.bodyLength()}`);\n }\n return lines.join(BYTE.LF) + BYTE.LF + BYTE.LF;\n }\n\n private isBodyEmpty(): boolean {\n return this.bodyLength() === 0;\n }\n\n private bodyLength(): number {\n const binaryBody = this.binaryBody;\n return binaryBody ? binaryBody.length : 0;\n }\n\n /**\n * Compute the size of a UTF-8 string by counting its number of bytes\n * (and not the number of characters composing the string)\n */\n private static sizeOfUTF8(s: string): number {\n return s ? new TextEncoder().encode(s).length : 0;\n }\n\n private static toUnit8Array(\n cmdAndHeaders: string,\n binaryBody: Uint8Array\n ): Uint8Array {\n const uint8CmdAndHeaders = new TextEncoder().encode(cmdAndHeaders);\n const nullTerminator = new Uint8Array([0]);\n const uint8Frame = new Uint8Array(\n uint8CmdAndHeaders.length + binaryBody.length + nullTerminator.length\n );\n\n uint8Frame.set(uint8CmdAndHeaders);\n uint8Frame.set(binaryBody, uint8CmdAndHeaders.length);\n uint8Frame.set(\n nullTerminator,\n uint8CmdAndHeaders.length + binaryBody.length\n );\n\n return uint8Frame;\n }\n /**\n * Serialize a STOMP frame as per STOMP standards, suitable to be sent to the STOMP broker.\n *\n * @internal\n */\n public static marshall(params: {\n command: string;\n headers?: StompHeaders;\n body?: string;\n binaryBody?: Uint8Array;\n escapeHeaderValues?: boolean;\n skipContentLengthHeader?: boolean;\n }) {\n const frame = new FrameImpl(params);\n return frame.serialize();\n }\n\n /**\n * Escape header values\n */\n private static hdrValueEscape(str: string): string {\n return str\n .replace(/\\\\/g, '\\\\\\\\')\n .replace(/\\r/g, '\\\\r')\n .replace(/\\n/g, '\\\\n')\n .replace(/:/g, '\\\\c');\n }\n\n /**\n * UnEscape header values\n */\n private static hdrValueUnEscape(str: string): string {\n return str\n .replace(/\\\\r/g, '\\r')\n .replace(/\\\\n/g, '\\n')\n .replace(/\\\\c/g, ':')\n .replace(/\\\\\\\\/g, '\\\\');\n }\n}\n","import { IRawFrameType } from './types';\n\n/**\n * @internal\n */\nconst NULL = 0;\n/**\n * @internal\n */\nconst LF = 10;\n/**\n * @internal\n */\nconst CR = 13;\n/**\n * @internal\n */\nconst COLON = 58;\n\n/**\n * This is an evented, rec descent parser.\n * A stream of Octets can be passed and whenever it recognizes\n * a complete Frame or an incoming ping it will invoke the registered callbacks.\n *\n * All incoming Octets are fed into _onByte function.\n * Depending on current state the _onByte function keeps changing.\n * Depending on the state it keeps accumulating into _token and _results.\n * State is indicated by current value of _onByte, all states are named as _collect.\n *\n * STOMP standards https://stomp.github.io/stomp-specification-1.2.html\n * imply that all lengths are considered in bytes (instead of string lengths).\n * So, before actual parsing, if the incoming data is String it is converted to Octets.\n * This allows faithful implementation of the protocol and allows NULL Octets to be present in the body.\n *\n * There is no peek function on the incoming data.\n * When a state change occurs based on an Octet without consuming the Octet,\n * the Octet, after state change, is fed again (_reinjectByte).\n * This became possible as the state change can be determined by inspecting just one Octet.\n *\n * There are two modes to collect the body, if content-length header is there then it by counting Octets\n * otherwise it is determined by NULL terminator.\n *\n * Following the standards, the command and headers are converted to Strings\n * and the body is returned as Octets.\n * Headers are returned as an array and not as Hash - to allow multiple occurrence of an header.\n *\n * This parser does not use Regular Expressions as that can only operate on Strings.\n *\n * It handles if multiple STOMP frames are given as one chunk, a frame is split into multiple chunks, or\n * any combination there of. The parser remembers its state (any partial frame) and continues when a new chunk\n * is pushed.\n *\n * Typically the higher level function will convert headers to Hash, handle unescaping of header values\n * (which is protocol version specific), and convert body to text.\n *\n * Check the parser.spec.js to understand cases that this parser is supposed to handle.\n *\n * Part of `@stomp/stompjs`.\n *\n * @internal\n */\nexport class Parser {\n private readonly _encoder = new TextEncoder();\n private readonly _decoder = new TextDecoder();\n\n private _results: IRawFrameType;\n\n private _token: number[] = [];\n private _headerKey: string;\n private _bodyBytesRemaining: number;\n\n private _onByte: (byte: number) => void;\n\n public constructor(\n public onFrame: (rawFrame: IRawFrameType) => void,\n public onIncomingPing: () => void\n ) {\n this._initState();\n }\n\n public parseChunk(\n segment: string | ArrayBuffer,\n appendMissingNULLonIncoming: boolean = false\n ) {\n let chunk: Uint8Array;\n\n if (segment instanceof ArrayBuffer) {\n chunk = new Uint8Array(segment);\n } else {\n chunk = this._encoder.encode(segment);\n }\n\n // See https://github.com/stomp-js/stompjs/issues/89\n // Remove when underlying issue is fixed.\n //\n // Send a NULL byte, if the last byte of a Text frame was not NULL.F\n if (appendMissingNULLonIncoming && chunk[chunk.length - 1] !== 0) {\n const chunkWithNull = new Uint8Array(chunk.length + 1);\n chunkWithNull.set(chunk, 0);\n chunkWithNull[chunk.length] = 0;\n chunk = chunkWithNull;\n }\n\n // tslint:disable-next-line:prefer-for-of\n for (let i = 0; i < chunk.length; i++) {\n const byte = chunk[i];\n this._onByte(byte);\n }\n }\n\n // The following implements a simple Rec Descent Parser.\n // The grammar is simple and just one byte tells what should be the next state\n\n private _collectFrame(byte: number): void {\n if (byte === NULL) {\n // Ignore\n return;\n }\n if (byte === CR) {\n // Ignore CR\n return;\n }\n if (byte === LF) {\n // Incoming Ping\n this.onIncomingPing();\n return;\n }\n\n this._onByte = this._collectCommand;\n this._reinjectByte(byte);\n }\n\n private _collectCommand(byte: number): void {\n if (byte === CR) {\n // Ignore CR\n return;\n }\n if (byte === LF) {\n this._results.command = this._consumeTokenAsUTF8();\n this._onByte = this._collectHeaders;\n return;\n }\n\n this._consumeByte(byte);\n }\n\n private _collectHeaders(byte: number): void {\n if (byte === CR) {\n // Ignore CR\n return;\n }\n if (byte === LF) {\n this._setupCollectBody();\n return;\n }\n this._onByte = this._collectHeaderKey;\n this._reinjectByte(byte);\n }\n\n private _reinjectByte(byte: number) {\n this._onByte(byte);\n }\n\n private _collectHeaderKey(byte: number): void {\n if (byte === COLON) {\n this._headerKey = this._consumeTokenAsUTF8();\n this._onByte = this._collectHeaderValue;\n return;\n }\n this._consumeByte(byte);\n }\n\n private _collectHeaderValue(byte: number): void {\n if (byte === CR) {\n // Ignore CR\n return;\n }\n if (byte === LF) {\n this._results.headers.push([this._headerKey, this._consumeTokenAsUTF8()]);\n this._headerKey = undefined;\n this._onByte = this._collectHeaders;\n return;\n }\n this._consumeByte(byte);\n }\n\n private _setupCollectBody() {\n const contentLengthHeader = this._results.headers.filter(\n (header: [string, string]) => {\n return header[0] === 'content-length';\n }\n )[0];\n\n if (contentLengthHeader) {\n this._bodyBytesRemaining = parseInt(contentLengthHeader[1], 10);\n this._onByte = this._collectBodyFixedSize;\n } else {\n this._onByte = this._collectBodyNullTerminated;\n }\n }\n\n private _collectBodyNullTerminated(byte: number): void {\n if (byte === NULL) {\n this._retrievedBody();\n return;\n }\n this._consumeByte(byte);\n }\n\n private _collectBodyFixedSize(byte: number): void {\n // It is post decrement, so that we discard the trailing NULL octet\n if (this._bodyBytesRemaining-- === 0) {\n this._retrievedBody();\n return;\n }\n this._consumeByte(byte);\n }\n\n private _retrievedBody() {\n this._results.binaryBody = this._consumeTokenAsRaw();\n\n this.onFrame(this._results);\n\n this._initState();\n }\n\n // Rec Descent Parser helpers\n\n private _consumeByte(byte: number) {\n this._token.push(byte);\n }\n\n private _consumeTokenAsUTF8() {\n return this._decoder.decode(this._consumeTokenAsRaw());\n }\n\n private _consumeTokenAsRaw() {\n const rawResult = new Uint8Array(this._token);\n this._token = [];\n return rawResult;\n }\n\n private _initState() {\n this._results = {\n command: undefined,\n headers: [],\n binaryBody: undefined,\n };\n\n this._token = [];\n this._headerKey = undefined;\n\n this._onByte = this._collectFrame;\n }\n}\n","import { IFrame } from './i-frame';\nimport { IMessage } from './i-message';\nimport { StompHeaders } from './stomp-headers';\n\n/**\n * This callback will receive a `string` as parameter.\n *\n * Part of `@stomp/stompjs`.\n */\nexport type debugFnType = (msg: string) => void;\n\n/**\n * This callback will receive a {@link IMessage} as parameter.\n *\n * Part of `@stomp/stompjs`.\n */\nexport type messageCallbackType = (message: IMessage) => void;\n\n/**\n * This callback will receive a {@link IFrame} as parameter.\n *\n * Part of `@stomp/stompjs`.\n */\nexport type frameCallbackType = (receipt: IFrame) => void;\n\n/**\n * This callback will receive a [CloseEvent]{@link https://developer.mozilla.org/en-US/docs/Web/API/CloseEvent}\n * as parameter.\n *\n * Part of `@stomp/stompjs`.\n */\nexport type closeEventCallbackType<T = any> = (evt: T) => void;\n\n/**\n * This callback will receive an [Event]{@link https://developer.mozilla.org/en-US/docs/Web/API/Event}\n * as parameter.\n *\n * Part of `@stomp/stompjs`.\n */\nexport type wsErrorCallbackType<T = any> = (evt: T) => void;\n\n/**\n * Parameters for [Client#publish]{@link Client#publish}.\n * Aliased as publishParams as well.\n *\n * Part of `@stomp/stompjs`.\n */\nexport interface IPublishParams {\n /**\n * destination end point\n */\n destination: string;\n /**\n * headers (optional)\n */\n headers?: StompHeaders;\n /**\n * body (optional)\n */\n body?: string;\n /**\n * binary body (optional)\n */\n binaryBody?: Uint8Array;\n /**\n * By default a `content-length` header will be added in the Frame to the broker.\n * Set it to `true` for the header to be skipped.\n */\n skipContentLengthHeader?: boolean;\n}\n\n/**\n * Backward compatibility, switch to {@link IPublishParams}.\n */\nexport type publishParams = IPublishParams;\n\n/**\n * Used in {@link IRawFrameType}\n *\n * Part of `@stomp/stompjs`.\n *\n * @internal\n */\nexport type RawHeaderType = [string, string];\n\n/**\n * The parser yield frames in this structure\n *\n * Part of `@stomp/stompjs`.\n *\n * @internal\n */\nexport interface IRawFrameType {\n command: string;\n headers: RawHeaderType[];\n binaryBody: Uint8Array;\n}\n\n/**\n * @internal\n */\nexport interface IStompSocketMessageEvent {\n data?: string | ArrayBuffer;\n}\n\n/**\n * Copied from Websocket interface to avoid dom typelib dependency.\n *\n * @internal\n */\nexport interface IStompSocket {\n onclose: ((this: IStompSocket, ev?: any) => any) | null;\n onerror: ((this: IStompSocket, ev: any) => any) | null;\n onmessage: ((this: IStompSocket, ev: IStompSocketMessageEvent) => any) | null;\n onopen: ((this: IStompSocket, ev?: any) => any) | null;\n terminate?: ((this: IStompSocket) => any) | null;\n\n /**\n * Returns a string that indicates how binary data from the socket is exposed to scripts:\n * We support only 'arraybuffer'.\n */\n binaryType: 'arraybuffer';\n\n /**\n * Returns the state of the socket connection. It can have the values of StompSocketState.\n */\n readonly readyState: number;\n\n /**\n * Closes the connection.\n */\n close(): void;\n /**\n * Transmits data using the connection. data can be a string or an ArrayBuffer.\n */\n send(data: string | ArrayBuffer): void;\n}\n\n/**\n * Possible states for the IStompSocket\n */\nexport enum StompSocketState {\n CONNECTING,\n OPEN,\n CLOSING,\n CLOSED,\n}\n\n/**\n * Possible activation state\n */\nexport enum ActivationState {\n ACTIVE,\n DEACTIVATING,\n INACTIVE,\n}\n","/**\n * Supported STOMP versions\n *\n * Part of `@stomp/stompjs`.\n */\nexport class Versions {\n /**\n * Indicates protocol version 1.0\n */\n public static V1_0 = '1.0';\n /**\n * Indicates protocol version 1.1\n */\n public static V1_1 = '1.1';\n /**\n * Indicates protocol version 1.2\n */\n public static V1_2 = '1.2';\n\n /**\n * @internal\n */\n public static default = new Versions([\n Versions.V1_0,\n Versions.V1_1,\n Versions.V1_2,\n ]);\n\n /**\n * Takes an array of string of versions, typical elements '1.0', '1.1', or '1.2'\n *\n * You will an instance if this class if you want to override supported versions to be declared during\n * STOMP handshake.\n */\n constructor(public versions: string[]) {}\n\n /**\n * Used as part of CONNECT STOMP Frame\n */\n public supportedVersions() {\n return this.versions.join(',');\n }\n\n /**\n * Used while creating a WebSocket\n */\n public protocolVersions() {\n return this.versions.map(x => `v${x.replace('.', '')}.stomp`);\n }\n}\n","import { BYTE } from './byte';\nimport { Client } from './client';\nimport { FrameImpl } from './frame-impl';\nimport { IMessage } from './i-message';\nimport { ITransaction } from './i-transaction';\nimport { Parser } from './parser';\nimport { StompConfig } from './stomp-config';\nimport { StompHeaders } from './stomp-headers';\nimport { StompSubscription } from './stomp-subscription';\nimport {\n closeEventCallbackType,\n debugFnType,\n frameCallbackType,\n IPublishParams,\n IStompSocket,\n IStompSocketMessageEvent,\n messageCallbackType,\n StompSocketState,\n wsErrorCallbackType,\n} from './types';\nimport { Versions } from './versions';\nimport { augmentWebsocket } from './augment-websocket';\n\n/**\n * The STOMP protocol handler\n *\n * Part of `@stomp/stompjs`.\n *\n * @internal\n */\nexport class StompHandler {\n public debug: debugFnType;\n\n public stompVersions: Versions;\n\n public connectHeaders: StompHeaders;\n\n public disconnectHeaders: StompHeaders;\n\n public heartbeatIncoming: number;\n\n public heartbeatOutgoing: number;\n\n public onUnhandledMessage: messageCallbackType;\n\n public onUnhandledReceipt: frameCallbackType;\n\n public onUnhandledFrame: frameCallbackType;\n\n public onConnect: frameCallbackType;\n\n public onDisconnect: frameCallbackType;\n\n public onStompError: frameCallbackType;\n\n public onWebSocketClose: closeEventCallbackType;\n\n public onWebSocketError: wsErrorCallbackType;\n\n public logRawCommunication: boolean;\n\n public splitLargeFrames: boolean;\n\n public maxWebSocketChunkSize: number;\n\n public forceBinaryWSFrames: boolean;\n\n public appendMissingNULLonIncoming: boolean;\n\n public discardWebsocketOnCommFailure: boolean;\n\n get connectedVersion(): string {\n return this._connectedVersion;\n }\n private _connectedVersion: string;\n\n get connected(): boolean {\n return this._connected;\n }\n\n private _connected: boolean;\n\n private readonly _subscriptions: { [key: string]: messageCallbackType };\n private readonly _receiptWatchers: { [key: string]: frameCallbackType };\n private _partialData: string;\n private _escapeHeaderValues: boolean;\n private _counter: number;\n private _pinger: any;\n private _ponger: any;\n private _lastServerActivityTS: number;\n\n private _onclose: (closeEvent: any) => void;\n\n constructor(\n private _client: Client,\n public _webSocket: IStompSocket,\n config: StompConfig = {}\n ) {\n // used to index subscribers\n this._counter = 0;\n\n // subscription callbacks indexed by subscriber's ID\n this._subscriptions = {};\n\n // receipt-watchers indexed by receipts-ids\n this._receiptWatchers = {};\n\n this._partialData = '';\n\n this._escapeHeaderValues = false;\n\n this._lastServerActivityTS = Date.now();\n\n this.configure(config);\n }\n\n public configure(conf: StompConfig): void {\n // bulk assign all properties to this\n (Object as any).assign(this, conf);\n }\n\n public start(): void {\n const parser = new Parser(\n // On Frame\n rawFrame => {\n const frame = FrameImpl.fromRawFrame(\n rawFrame,\n this._escapeHeaderValues\n );\n\n // if this.logRawCommunication is set, the rawChunk is logged at this._webSocket.onmessage\n if (!this.logRawCommunication) {\n this.debug(`<<< ${frame}`);\n }\n\n const serverFrameHandler =\n this._serverFrameHandlers[frame.command] || this.onUnhandledFrame;\n serverFrameHandler(frame);\n },\n // On Incoming Ping\n () => {\n this.debug('<<< PONG');\n }\n );\n\n this._webSocket.onmessage = (evt: IStompSocketMessageEvent) => {\n this.debug('Received data');\n this._lastServerActivityTS = Date.now();\n\n if (this.logRawCommunication) {\n const rawChunkAsString =\n evt.data instanceof ArrayBuffer\n ? new TextDecoder().decode(evt.data)\n : evt.data;\n this.debug(`<<< ${rawChunkAsString}`);\n }\n\n parser.parseChunk(evt.data, this.appendMissingNULLonIncoming);\n };\n\n this._onclose = (closeEvent): void => {\n this.debug(`Connection closed to ${this._client.brokerURL}`);\n this._cleanUp();\n this.onWebSocketClose(closeEvent);\n };\n\n this._webSocket.onclose = this._onclose;\n\n this._webSocket.onerror = (errorEvent): void => {\n this.onWebSocketError(errorEvent);\n };\n\n this._webSocket.onopen = () => {\n // Clone before updating\n const connectHeaders = (Object as any).assign({}, this.connectHeaders);\n\n this.debug('Web Socket Opened...');\n connectHeaders['accept-version'] = this.stompVersions.supportedVersions();\n connectHeaders['heart-beat'] = [\n this.heartbeatOutgoing,\n this.heartbeatIncoming,\n ].join(',');\n this._transmit({ command: 'CONNECT', headers: connectHeaders });\n };\n }\n\n private readonly _serverFrameHandlers: {\n [key: string]: frameCallbackType;\n } = {\n // [CONNECTED Frame](http://stomp.github.com/stomp-specification-1.2.html#CONNECTED_Frame)\n CONNECTED: frame => {\n this.debug(`connected to server ${frame.headers.server}`);\n this._connected = true;\n this._connectedVersion = frame.headers.version;\n // STOMP version 1.2 needs header values to be escaped\n if (this._connectedVersion === Versions.V1_2) {\n this._escapeHeaderValues = true;\n }\n\n this._setupHeartbeat(frame.headers);\n this.onConnect(frame);\n },\n\n // [MESSAGE Frame](http://stomp.github.com/stomp-specification-1.2.html#MESSAGE)\n MESSAGE: frame => {\n // the callback is registered when the client calls\n // `subscribe()`.\n // If there is no registered subscription for the received message,\n // the default `onUnhandledMessage` callback is used that the client can set.\n // This is useful for subscriptions that are automatically created\n // on the browser side (e.g. [RabbitMQ's temporary\n // queues](http://www.rabbitmq.com/stomp.html)).\n const subscription = frame.headers.subscription;\n const onReceive =\n this._subscriptions[subscription] || this.onUnhandledMessage;\n\n // bless the frame to be a Message\n const message = frame as IMessage;\n\n const client = this;\n const messageId =\n this._connectedVersion === Versions.V1_2\n ? message.headers.ack\n : message.headers['message-id'];\n\n // add `ack()` and `nack()` methods directly to the returned frame\n // so that a simple call to `message.ack()` can acknowledge the message.\n message.ack = (headers: StompHeaders = {}): void => {\n return client.ack(messageId, subscription, headers);\n };\n message.nack = (headers: StompHeaders = {}): void => {\n return client.nack(messageId, subscription, headers);\n };\n onReceive(message);\n },\n\n // [RECEIPT Frame](http://stomp.github.com/stomp-specification-1.2.html#RECEIPT)\n RECEIPT: frame => {\n const callback = this._receiptWatchers[frame.headers['receipt-id']];\n if (callback) {\n callback(frame);\n // Server will acknowledge only once, remove the callback\n delete this._receiptWatchers[frame.headers['receipt-id']];\n } else {\n this.onUnhandledReceipt(frame);\n }\n },\n\n // [ERROR Frame](http://stomp.github.com/stomp-specification-1.2.html#ERROR)\n ERROR: frame => {\n this.onStompError(frame);\n },\n };\n\n private _setupHeartbeat(headers: StompHeaders): void {\n if (\n headers.version !== Versions.V1_1 &&\n headers.version !== Versions.V1_2\n ) {\n return;\n }\n\n // It is valid for the server to not send this header\n // https://stomp.github.io/stomp-specification-1.2.html#Heart-beating\n if (!headers['heart-beat']) {\n return;\n }\n\n // heart-beat header received from the server looks like:\n //\n // heart-beat: sx, sy\n const [serverOutgoing, serverIncoming] = headers['heart-beat']\n .split(',')\n .map((v: string) => parseInt(v, 10));\n\n if (this.heartbeatOutgoing !== 0 && serverIncoming !== 0) {\n const ttl: number = Math.max(this.heartbeatOutgoing, serverIncoming);\n this.debug(`send PING every ${ttl}ms`);\n this._pinger = setInterval(() => {\n if (this._webSocket.readyState === StompSocketState.OPEN) {\n this._webSocket.send(BYTE.LF);\n this.debug('>>> PING');\n }\n }, ttl);\n }\n\n if (this.heartbeatIncoming !== 0 && serverOutgoing !== 0) {\n const ttl: number = Math.max(this.heartbeatIncoming, serverOutgoing);\n this.debug(`check PONG every ${ttl}ms`);\n this._ponger = setInterval(() => {\n const delta = Date.now() - this._lastServerActivityTS;\n // We wait twice the TTL to be flexible on window's setInterval calls\n if (delta > ttl * 2) {\n this.debug(`did not receive server activity for the last ${delta}ms`);\n this._closeOrDiscardWebsocket();\n }\n }, ttl);\n }\n }\n\n private _closeOrDiscardWebsocket() {\n if (this.discardWebsocketOnCommFailure) {\n this.debug(\n \"Discarding websocket, the underlying socket may linger for a while\"\n );\n this._discardWebsocket();\n } else {\n this.debug(\"Issuing close on the websocket\");\n this._closeWebsocket();\n }\n }\n\n public forceDisconnect() {\n if (this._webSocket) {\n if (\n this._webSocket.readyState === StompSocketState.CONNECTING ||\n this._webSocket.readyState === StompSocketState.OPEN\n ) {\n this._closeOrDiscardWebsocket();\n }\n }\n }\n\n public _closeWebsocket() {\n this._webSocket.onmessage = () => {}; // ignore messages\n this._webSocket.close();\n }\n\n private _discardWebsocket() {\n if (!this._webSocket.terminate) {\n augmentWebsocket(this._webSocket, (msg: string) => this.debug(msg));\n }\n\n this._webSocket.terminate();\n }\n\n private _transmit(params: {\n command: string;\n headers?: StompHeaders;\n body?: string;\n binaryBody?: Uint8Array;\n skipContentLengthHeader?: boolean;\n }): void {\n const {\n command,\n headers,\n body,\n binaryBody,\n skipContentLengthHeader,\n } = params;\n const frame = new FrameImpl({\n command,\n headers,\n body,\n binaryBody,\n escapeHeaderValues: this._escapeHeaderValues,\n skipContentLengthHeader,\n });\n\n let rawChunk = frame.serialize();\n\n if (this.logRawCommunication) {\n this.debug(`>>> ${rawChunk}`);\n } else {\n this.debug(`>>> ${frame}`);\n }\n\n if (this.forceBinaryWSFrames && typeof rawChunk === 'string') {\n rawChunk = new TextEncoder().encode(rawChunk);\n }\n\n if (typeof rawChunk !== 'string' || !this.splitLargeFrames) {\n this._webSocket.send(rawChunk);\n } else {\n let out = rawChunk as string;\n while (out.length > 0) {\n const chunk = out.substring(0, this.maxWebSocketChunkSize);\n out = out.substring(this.maxWebSocketChunkSize);\n this._webSocket.send(chunk);\n this.debug(`chunk sent = ${chunk.length}, remaining = ${out.length}`);\n }\n }\n }\n\n public dispose(): void {\n if (this.connected) {\n try {\n // clone before updating\n const disconnectHeaders = (Object as any).assign(\n {},\n this.disconnectHeaders\n );\n\n if (!disconnectHeaders.receipt) {\n disconnectHeaders.receipt = `close-${this._counter++}`;\n }\n this.watchForReceipt(disconnectHeaders.receipt, frame => {\n this._closeWebsocket();\n this._cleanUp();\n this.onDisconnect(frame);\n });\n this._transmit({ command: 'DISCONNECT', headers: disconnectHeaders });\n } catch (error) {\n this.debug(`Ignoring error during disconnect ${error}`);\n }\n } else {\n if (\n this._webSocket.readyState === StompSocketState.CONNECTING ||\n this._webSocket.readyState === StompSocketState.OPEN\n ) {\n this._closeWebsocket();\n }\n }\n }\n\n private _cleanUp() {\n this._connected = false;\n\n if (this._pinger) {\n clearInterval(this._pinger);\n }\n if (this._ponger) {\n clearInterval(this._ponger);\n }\n }\n\n public publish(params: IPublishParams): void {\n const {\n destination,\n headers,\n body,\n binaryBody,\n skipContentLengthHeader,\n } = params;\n const hdrs: StompHeaders = (Object as any).assign({ destination }, headers);\n this._transmit({\n command: 'SEND',\n headers: hdrs,\n body,\n binaryBody,\n skipContentLengthHeader,\n });\n }\n\n public watchForReceipt(receiptId: string, callback: frameCallbackType): void {\n this._receiptWatchers[receiptId] = callback;\n }\n\n public subscribe(\n destination: string,\n callback: messageCallbackType,\n headers: StompHeaders = {}\n ): StompSubscription {\n headers = (Object as any).assign({}, headers);\n\n if (!headers.id) {\n headers.id = `sub-${this._counter++}`;\n }\n headers.destination = destination;\n this._subscriptions[headers.id] = callback;\n this._transmit({ command: 'SUBSCRIBE', headers });\n const client = this;\n return {\n id: headers.id,\n\n unsubscribe(hdrs) {\n return client.unsubscribe(headers.id, hdrs);\n },\n };\n }\n\n public unsubscribe(id: string, headers: StompHeaders = {}): void {\n headers = (Object as any).assign({}, headers);\n\n delete this._subscriptions[id];\n headers.id = id;\n this._transmit({ command: 'UNSUBSCRIBE', headers });\n }\n\n public begin(transactionId: string): ITransaction {\n const txId = transactionId || `tx-${this._counter++}`;\n this._transmit({\n command: 'BEGIN',\n headers: {\n transaction: txId,\n },\n });\n const client = this;\n return {\n id: txId,\n commit(): void {\n client.commit(txId);\n },\n abort(): void {\n client.abort(txId);\n },\n };\n }\n\n public commit(transactionId: string): void {\n this._transmit({\n command: 'COMMIT',\n headers: {\n transaction: transactionId,\n },\n });\n }\n\n public abort(transactionId: string): void {\n this._transmit({\n command: 'ABORT',\n headers: {\n transaction: transactionId,\n },\n });\n }\n\n public ack(\n messageId: string,\n subscriptionId: string,\n headers: StompHeaders = {}\n ): void {\n headers = (Object as any).assign({}, headers);\n\n if (this._connectedVersion === Versions.V1_2) {\n headers.id = messageId;\n } else {\n headers['message-id'] = messageId;\n }\n headers.subscription = subscriptionId;\n this._transmit({ command: 'ACK', headers });\n }\n\n public nack(\n messageId: string,\n subscriptionId: string,\n headers: StompHeaders = {}\n ): void {\n headers = (Object as any).assign({}, headers);\n\n if (this._connectedVersion === Versions.V1_2) {\n headers.id = messageId;\n } else {\n headers['message-id'] = messageId;\n }\n headers.subscription = subscriptionId;\n return this._transmit({ command: 'NACK', headers });\n }\n}\n","import { IStompSocket } from './types';\n\n/**\n * @internal\n */\nexport function augmentWebsocket(\n webSocket: IStompSocket,\n debug: (msg: string) => void\n) {\n webSocket.terminate = function () {\n const noOp = () => {};\n\n // set all callbacks to no op\n this.onerror = noOp;\n this.onmessage = noOp;\n this.onopen = noOp;\n\n const ts = new Date();\n\n const origOnClose = this.onclose;\n\n // Track delay in actual closure of the socket\n this.onclose = closeEvent => {\n const delay = new Date().getTime() - ts.getTime();\n debug(\n `Discarded socket closed after ${delay}ms, with code/reason: ${closeEvent.code}/${closeEvent.reason}`\n );\n };\n\n this.close();\n\n origOnClose.call(this, {\n code: 4001,\n reason: 'Heartbeat failure, discarding the socket',\n wasClean: false,\n });\n };\n}\n","import { ITransaction } from './i-transaction';\nimport { StompConfig } from './stomp-config';\nimport { StompHandler } from './stomp-handler';\nimport { StompHeaders } from './stomp-headers';\nimport { StompSubscription } from './stomp-subscription';\nimport {\n ActivationState,\n closeEventCallbackType,\n debugFnType,\n frameCallbackType,\n IPublishParams,\n IStompSocket,\n messageCallbackType,\n StompSocketState,\n wsErrorCallbackType,\n} from './types';\nimport { Versions } from './versions';\n\n/**\n * @internal\n */\ndeclare const WebSocket: {\n prototype: IStompSocket;\n new (url: string, protocols?: string | string[]): IStompSocket;\n};\n\n/**\n * STOMP Client Class.\n *\n * Part of `@stomp/stompjs`.\n */\nexport class Client {\n /**\n * The URL for the STOMP broker to connect to.\n * Typically like `\"ws://broker.329broker.com:15674/ws\"` or `\"wss://broker.329broker.com:15674/ws\"`.\n *\n * Only one of this or [Client#webSocketFactory]{@link Client#webSocketFactory} need to be set.\n * If both are set, [Client#webSocketFactory]{@link Client#webSocketFactory} will be used.\n *\n * If your environment does not support WebSockets natively, please refer to\n * [Polyfills]{@link https://stomp-js.github.io/guide/stompjs/rx-stomp/ng2-stompjs/pollyfils-for-stompjs-v5.html}.\n */\n public brokerURL: string;\n\n /**\n * STOMP versions to attempt during STOMP handshake. By default versions `1.0`, `1.1`, and `1.2` are attempted.\n *\n * Example:\n * ```javascript\n * // Try only versions 1.0 and 1.1\n * client.stompVersions = new Versions(['1.0', '1.1'])\n * ```\n */\n public stompVersions = Versions.default;\n\n /**\n * This function should return a WebSocket or a similar (e.g. SockJS) object.\n * If your environment does not support WebSockets natively, please refer to\n * [Polyfills]{@link https://stomp-js.github.io/guide/stompjs/rx-stomp/ng2-stompjs/pollyfils-for-stompjs-v5.html}.\n * If your STOMP Broker supports WebSockets, prefer setting [Client#brokerURL]{@link Client#brokerURL}.\n *\n * If both this and [Client#brokerURL]{@link Client#brokerURL} are set, this will be used.\n *\n * Example:\n * ```javascript\n * // use a WebSocket\n * client.webSocketFactory= function () {\n * return new WebSocket(\"wss://broker.329broker.com:15674/ws\");\n * };\n *\n * // Typical usage with SockJS\n * client.webSocketFactory= function () {\n * return new SockJS(\"http://broker.329broker.com/stomp\");\n * };\n * ```\n */\n public webSocketFactory: () => IStompSocket;\n\n /**\n * Will retry if Stomp connection is not established in specified milliseconds.\n * Default 10,000ms, set to 0 to wait for ever.\n */\n public connectionTimeout: number = 10000;\n\n private _connectionWatcher: number; // Timer\n\n /**\n * automatically reconnect with delay in milliseconds, set to 0 to disable.\n */\n public reconnectDelay: number = 5000;\n\n /**\n * Incoming heartbeat interval in milliseconds. Set to 0 to disable.\n */\n public heartbeatIncoming: number = 10000;\n\n /**\n * Outgoing heartbeat interval in milliseconds. Set to 0 to disable.\n */\n public heartbeatOutgoing: number = 10000;\n\n /**\n * This switches on a non standard behavior while sending WebSocket packets.\n * It splits larger (text) packets into chunks of [maxWebSocketChunkSize]{@link Client#maxWebSocketChunkSize}.\n * Only Java Spring brokers seems to use this mode.\n *\n * WebSockets, by itself, split large (text) packets,\n * so it is not needed with a truly compliant STOMP/WebSocket broker.\n * Actually setting it for such broker will cause large messages to fail.\n *\n * `false` by default.\n *\n * Binary frames are never split.\n */\n public splitLargeFrames: boolean = false;\n\n /**\n * See [splitLargeFrames]{@link Client#splitLargeFrames}.\n * This has no effect if [splitLargeFrames]{@link Client#splitLargeFrames} is `false`.\n */\n public maxWebSocketChunkSize: number = 8 * 1024;\n\n /**\n * Usually the\n * [type of WebSocket frame]{@link https://developer.mozilla.org/en-US/docs/Web/API/WebSocket/send#Parameters}\n * is automatically decided by type of the payload.\n * Default is `false`, which should work with all compliant brokers.\n *\n * Set this flag to force binary frames.\n */\n public forceBinaryWSFrames: boolean = false;\n\n /**\n * A bug in ReactNative chops a string on occurrence of a NULL.\n * See issue [https://github.com/stomp-js/stompjs/issues/89]{@link https://github.com/stomp-js/stompjs/issues/89}.\n * This makes incoming WebSocket messages invalid STOMP packets.\n * Setting this flag attempts to reverse the damage by appending a NULL.\n * If the broker splits a large message into multiple WebSocket messages,\n * this flag will cause data loss and abnormal termination of connection.\n *\n * This is not an ideal solution, but a stop gap until the underlying issue is fixed at ReactNative library.\n */\n public appendMissingNULLonIncoming: boolean = false;\n\n /**\n * Underlying WebSocket instance, READONLY.\n */\n get webSocket(): IStompSocket {\n return this._stompHandler ? this._stompHandler._webSocket : undefined;\n }\n\n /**\n * Connection headers, important keys - `login`, `passcode`, `host`.\n * Though STOMP 1.2 standard marks these keys to be present, check your broker documentation for\n * details specific to your broker.\n */\n public connectHeaders: StompHeaders;\n\n /**\n * Disconnection headers.\n */\n get disconnectHeaders(): StompHeaders {\n return this._disconnectHeaders;\n }\n\n set disconnectHeaders(value: StompHeaders) {\n this._disconnectHeaders = value;\n if (this._stompHandler) {\n this._stompHandler.disconnectHeaders = this._disconnectHeaders;\n }\n }\n private _disconnectHeaders: StompHeaders;\n\n /**\n * This function will be called for any unhandled messages.\n * It is useful for receiving messages sent to RabbitMQ temporary queues.\n *\n * It can also get invoked with stray messages while the server is processing\n * a request to [Client#unsubscribe]{@link Client#unsubscribe}\n * from an endpoint.\n *\n * The actual {@link IMessage} will be passed as parameter to the callback.\n */\n public onUnhandledMessage: messageCallbackType;\n\n /**\n * STOMP brokers can be requested to notify when an operation is actually completed.\n * Prefer using [Client#watchForReceipt]{@link Client#watchForReceipt}. See\n * [Client#watchForReceipt]{@link Client#watchForReceipt} for examples.\n *\n * The actual {@link FrameImpl} will be passed as parameter to the callback.\n */\n public onUnhandledReceipt: frameCallbackType;\n\n /**\n * Will be invoked if {@link FrameImpl} of unknown type is received from the STOMP broker.\n *\n * The actual {@link IFrame} will be passed as parameter to the callback.\n */\n public onUnhandledFrame: frameCallbackType;\n\n /**\n * `true` if there is a active connection with STOMP Broker\n */\n get connected(): boolean {\n return !!this._stompHandler && this._stompHandler.connected;\n }\n\n /**\n * Callback, invoked on before a connection connection to the STOMP broker.\n *\n * You can change options on the client, which will impact the immediate connect.\n * It is valid to call [Client#decativate]{@link Client#deactivate} in this callback.\n *\n * As of version 5.1, this callback can be\n * [async](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/async_function)\n * (i.e., it can return a\n * [Promise](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise)).\n * In that case connect will be called only after the Promise is resolved.\n * This can be used to reliably fetch credentials, access token etc. from some other service\n * in an asynchronous way.\n */\n public beforeConnect: () => void | Promise<void>;\n\n /**\n * Callback, invoked on every successful connection to the STOMP broker.\n *\n * The actual {@link FrameImpl} will be passed as parameter to the callback.\n * Sometimes clients will like to use headers from this frame.\n */\n public onConnect: frameCallbackType;\n\n /**\n * Callback, invoked on every successful disconnection from the STOMP broker. It will not be invoked if\n * the STOMP broker disconnected due to an error.\n *\n * The actual Receipt {@link FrameImpl} acknowledging the DISCONNECT will be passed as parameter to the callback.\n *\n * The way STOMP protocol is designed, the connection may close/terminate without the client\n * receiving the Receipt {@link FrameImpl} acknowledging the DISCONNECT.\n * You might find [Client#onWebSocketClose]{@link Client#onWebSocketClose} more appropriate to watch\n * STOMP broker disconnects.\n */\n public onDisconnect: frameCallbackType;\n\n /**\n * Callback, invoked on an ERROR frame received from the STOMP Broker.\n * A compliant STOMP Broker will close the connection after this type of frame.\n * Please check broker specific documentation for exact behavior.\n *\n * The actual {@link IFrame} will be passed as parameter to the callback.\n */\n public onStompError: frameCallbackType;\n\n /**\n * Callback, invoked when underlying WebSocket is closed.\n *\n * Actual [CloseEvent]{@link https://developer.mozilla.org/en-US/docs/Web/API/CloseEvent}\n * is passed as parameter to the callback.\n */\n public onWebSocketClose: closeEventCallbackType;\n\n /**\n * Callback, invoked when underlying WebSocket raises an error.\n *\n * Actual [Event]{@link https://developer.mozilla.org/en-US/docs/Web/API/Event}\n * is passed as parameter to the callback.\n */\n public onWebSocketError: wsErrorCallbackType;\n\n /**\n * Set it to log the actual raw communication with the broker.\n * When unset, it logs headers of the parsed frames.\n *\n * Change in this effects from next broker reconnect.\n *\n * **Caution: this assumes that frames only have valid UTF8 strings.**\n */\n public logRawCommunication: boolean;\n\n /**\n * By default, debug messages are discarded. To log to `console` following can be used:\n *\n * ```javascript\n * client.debug = function(str) {\n * console.log(str);\n * };\n * ```\n *\n * Currently this method does not support levels of log. Be aware that the output can be quite verbose\n * and may contain sensitive information (like passwords, tokens etc.).\n */\n public debug: debugFnType;\n\n /**\n * Browsers do not immediately close WebSockets when `.close` is issued.\n * This may cause reconnection to take a longer on certain type of failures.\n * In case of incoming heartbeat failure, this experimental flag instructs the library\n * to discard the socket immediately (even before it is actually closed).\n */\n public discardWebsocketOnCommFailure: boolean;\n\n /**\n * version of STOMP protocol negotiated with the server, READONLY\n */\n get connectedVersion(): string {\n return this._stompHandler ? this._stompHandler.connectedVersion : undefined;\n }\n\n private _stompHandler: StompHandler;\n\n /**\n * if the client is active (connected or going to reconnect)\n */\n get active(): boolean {\n return this.state === ActivationState.ACTIVE;\n }\n\n /**\n * It will be called on state change.\n *\n * When deactivating it may go from ACTIVE to INACTIVE without entering DEACTIVATING.\n */\n public onChangeState: (state: ActivationState) => void;\n\n private _changeState(state: ActivationState) {\n this.state = state;\n this.onChangeState(state);\n }\n\n // This will mark deactivate to complete, to be called after Websocket is closed\n private _resolveSocketClose: (value?: PromiseLike<void> | void) => void;\n\n /**\n * Activation state.\n *\n * It will usually be ACTIVE or INACTIVE.\n * When deactivating it may go from ACTIVE to INACTIVE without entering DEACTIVATING.\n */\n public state: ActivationState = ActivationState.INACTIVE;\n\n private _reconnector: any;\n\n /**\n * Create an instance.\n */\n constructor(conf: StompConfig = {}) {\n // Dummy callbacks\n const noOp = () => {};\n this.debug = noOp;\n this.beforeConnect = noOp;\n this.onConnect = noOp;\n this.onDisconnect = noOp;\n this.onUnhandledMessage = noOp;\n this.onUnhandledReceipt = noOp;\n this.onUnhandledFrame = noOp;\n this.onStompError = noOp;\n this.onWebSocketClose = noOp;\n this.onWebSocketError = noOp;\n this.logRawCommunication = false;\n this.onChangeState = noOp;\n\n // These parameters would typically get proper values before connect is called\n this.connectHeaders = {};\n this._disconnectHeaders = {};\n\n // Apply configuration\n this.configure(conf);\n }\n\n /**\n * Update configuration.\n */\n public configure(conf: StompConfig): void {\n // bulk assign all properties to this\n (Object as any).assign(this, conf);\n }\n\n /**\n * Initiate the connection with the broker.\n * If the connection breaks, as per [Client#reconnectDelay]{@link Client#reconnectDelay},\n * it will keep trying to reconnect.\n *\n * Call [Client#deactivate]{@link Client#deactivate} to disconnect and stop reconnection attempts.\n */\n public activate(): void {\n if (this.state === ActivationState.DEACTIVATING) {\n this.debug('Still DEACTIVATING, please await call to deactivate before trying to re-activate');\n throw new Error('Still DEACTIVATING, can not activate now');\n }\n\n if (this.active) {\n this.debug('Already ACTIVE, ignoring request to activate');\n return;\n }\n\n this._changeState(ActivationState.ACTIVE);\n\n this._connect();\n }\n\n private async _connect(): Promise<void> {\n if (this.connected) {\n this.debug('STOMP: already connected, nothing to do');\n return;\n }\n\n await this.beforeConnect();\n\n if (!this.active) {\n this.debug(\n 'Client has been marked inactive, will not attempt to connect'\n );\n return;\n }\n\n // setup connection watcher\n if (this.connectionTimeout > 0) {\n this._connectionWatcher = setTimeout(() => {\n // Connection not established, close the underlying socket\n // a reconnection will be attempted\n this.debug(\n `Connection not established in ${this.connectionTimeout}ms, closing socket`\n );\n this.forceDisconnect();\n }, this.connectionTimeout);\n }\n\n this.debug('Opening Web Socket...');\n\n // Get the actual WebSocket (or a similar object)\n const webSocket = this._createWebSocket();\n\n this._stompHandler = new StompHandler(this, webSocket, {\n debug: this.debug,\n stompVersions: this.stompVersions,\n connectHeaders: this.connectHeaders,\n disconnectHeaders: this._disconnectHeaders,\n heartbeatIncoming: this.heartbeatIncoming,\n heartbeatOutgoing: this.heartbeatOutgoing,\n splitLargeFrames: this.splitLargeFrames,\n maxWebSocketChunkSize: this.maxWebSocketChunkSize,\n forceBinaryWSFrames: this.forceBinaryWSFrames,\n logRawCommunication: this.logRawCommunication,\n appendMissingNULLonIncoming: this.appendMissingNULLonIncoming,\n discardWebsocketOnCommFailure: this.discardWebsocketOnCommFailure,\n\n onConnect: frame => {\n // Successfully connected, stop the connection watcher\n if (this._connectionWatcher) {\n clearTimeout(this._connectionWatcher);\n this._connectionWatcher = undefined;\n }\n\n if (!this.active) {\n this.debug(\n 'STOMP got connected while deactivate was issued, will disconnect now'\n );\n this._disposeStompHandler();\n return;\n }\n this.onConnect(frame);\n },\n onDisconnect: frame => {\n this.onDisconnect(frame);\n },\n onStompError: frame => {\n this.onStompError(frame);\n },\n onWebSocketClose: evt => {\n this._stompHandler = undefined; // a new one will be created in case of a reconnect\n\n if (this.state === ActivationState.DEACTIVATING) {\n // Mark deactivation complete\n this._resolveSocketClose();\n this._resolveSocketClose = undefined;\n this._changeState(ActivationState.INACTIVE);\n }\n\n this.onWebSocketClose(evt);\n // The callback is called before attempting to reconnect, this would allow the client\n // to be `deactivated` in the callback.\n if (this.active) {\n this._schedule_reconnect();\n }\n },\n onWebSocketError: evt => {\n this.onWebSocketError(evt);\n },\n onUnhandledMessage: message => {\n this.onUnhandledMessage(message);\n },\n onUnhandledReceipt: frame => {\n this.onUnhandledReceipt(frame);\n },\n onUnhandledFrame: frame => {\n this.onUnhandledFrame(frame);\n },\n });\n\n this._stompHandler.start();\n }\n\n private _createWebSocket(): IStompSocket {\n let webSocket: IStompSocket;\n\n if (this.webSocketFactory) {\n webSocket = this.webSocketFactory();\n } else {\n webSocket = new WebSocket(\n this.brokerURL,\n this.stompVersions.protocolVersions()\n );\n }\n webSocket.binaryType = 'arraybuffer';\n return webSocket;\n }\n\n private _schedule_reconnect(): void {\n if (this.reconnectDelay > 0) {\n this.debug(`STOMP: scheduling reconnection in ${this.reconnectDelay}ms`);\n\n this._reconnector = setTimeout(() => {\n this._connect();\n }, this.reconnectDelay);\n }\n }\n\n /**\n * Disconnect if connected and stop auto reconnect loop.\n * Appropriate callbacks will be invoked if underlying STOMP connection was connected.\n *\n * This call is async, it will resolve immediately if there is no underlying active websocket,\n * otherwise, it will resolve after underlying websocket is properly disposed.\n *\n * To reactivate you can call [Client#activate]{@link Client#activate}.\n */\n public async deactivate(): Promise<void> {\n let retPromise: Promise<void>;\n\n if (this.state !== ActivationState.ACTIVE) {\n this.debug(\n `Already ${ActivationState[this.state]}, ignoring call to deactivate`\n );\n return Promise.resolve();\n }\n\n this._changeState(ActivationState.DEACTIVATING);\n\n // Clear if a reconnection was scheduled\n if (this._reconnector) {\n clearTimeout(this._reconnector);\n }\n\n if (\n this._stompHandler &&\n this.webSocket.readyState !== StompSocketState.CLOSED\n ) {\n // we need to wait for underlying websocket to close\n retPromise = new Promise<void>((resolve, reject) => {\n this._resolveSocketClose = resolve;\n });\n } else {\n // indicate that auto reconnect loop should terminate\n this._changeState(ActivationState.INACTIVE);\n return Promise.resolve();\n }\n\n this._disposeStompHandler();\n\n return retPromise;\n }\n\n /**\n * Force disconnect if there is an active connection by directly closing the underlying WebSocket.\n * This is different than a normal disconnect where a DISCONNECT sequence is carried out with the broker.\n * After forcing disconnect, automatic reconnect will be attempted.\n * To stop further reconnects call [Client#deactivate]{@link Client#deactivate} as well.\n */\n public forceDisconnect() {\n if (this._stompHandler) {\n this._stompHandler.forceDisconnect();\n }\n }\n\n private _disposeStompHandler() {\n // Dispose STOMP Handler\n if (this._stompHandler) {\n this._stompHandler.dispose();\n this._stompHandler = null;\n }\n }\n\n /**\n * Send a message to a named destination. Refer to your STOMP broker documentation for types\n * and naming of destinations.\n *\n * STOMP protocol specifies and suggests some headers and also allows broker specific headers.\n *\n * `body` must be String.\n * You will need to covert the payload to string in case it is not string (e.g. JSON).\n *\n * To send a binary message body use binaryBody parameter. It should be a\n * [Uint8Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Uint8Array).\n * Sometimes brokers may not support binary frames out of the box.\n * Please check your broker documentation.\n *\n * `content-length` header is automatically added to the STOMP Frame sent to the broker.\n * Set `skipContentLengthHeader` to indicate that `content-length` header should not be added.\n * For binary messages `content-length` header is always added.\n *\n * Caution: The broker will, most likely, report an error and disconnect if message body has NULL octet(s)\n * and `content-length` header is missing.\n *\n * ```javascript\n * client.publish({destination: \"/queue/test\", headers: {priority: 9}, body: \"Hello, STOMP\"});\n *\n * // Only destination is mandatory parameter\n * client.publish({destination: \"/queue/test\", body: \"Hello, STOMP\"});\n *\n * // Skip content-length header in the frame to the broker\n * client.publish({\"/queue/test\", body: \"Hello, STOMP\", skipContentLengthHeader: true});\n *\n * var binaryData = generateBinaryData(); // This need to be of type Uint8Array\n * // setting content-type header is not mandatory, however a good practice\n * client.publish({destination: '/topic/special', binaryBody: binaryData,\n * headers: {'content-type': 'application/octet-stream'}});\n * ```\n */\n public publish(params: IPublishParams) {\n this._stompHandler.publish(params);\n }\n\n /**\n * STOMP brokers may carry out operation asynchronously and allow requesting for acknowledgement.\n * To request an acknowledgement, a `receipt` header needs to be sent with the actual request.\n * The value (say receipt-id) for this header needs to be unique for each use. Typically a sequence, a UUID, a\n * random number or a combination may be used.\n *\n * A complaint broker will send a RECEIPT frame when an operation has actually been completed.\n * The operation needs to be matched based in the value of the receipt-id.\n *\n * This method allow watching for a receipt and invoke the callback\n * when corresponding receipt has been received.\n *\n * The actual {@link FrameImpl} will be passed as parameter to the callback.\n *\n * Example:\n * ```javascript\n * // Subscribing with acknowledgement\n * let receiptId = randomText();\n *\n * client.watchForReceipt(receiptId, function() {\n * // Will be called after server acknowledges\n * });\n *\n * client.subscribe(TEST.destination, onMessage, {receipt: receiptId});\n *\n *\n * // Publishing with acknowledgement\n * receiptId = randomText();\n *\n * client.watchForReceipt(receiptId, function() {\n * // Will be called after server acknowledges\n * });\n * client.publish({destination: TEST.destination, headers: {receipt: receiptId}, body: msg});\n * ```\n */\n public watchForReceipt(receiptId: string, callback: frameCallbackType): void {\n this._stompHandler.watchForReceipt(receiptId, callback);\n }\n\n /**\n * Subscribe to a STOMP Broker location. The callback will be invoked for each received message with\n * the {@link IMessage} as argument.\n *\n * Note: The library will generate an unique ID if there is none provided in the headers.\n * To use your own ID, pass it using the headers argument.\n *\n * ```javascript\n * callback = function(message) {\n * // called when the client receives a STOMP message from the server\n * if (message.body) {\n * alert(\"got message with body \" + message.body)\n * } else {\n * alert(\"got empty message\");\n * }\n * });\n *\n * var subscription = client.subscribe(\"/queue/test\", callback);\n *\n * // Explicit subscription id\n * var mySubId = 'my-subscription-id-001';\n * var subscription = client.subscribe(destination, callback, { id: mySubId });\n * ```\n */\n public subscribe(\n destination: string,\n callback: messageCallbackType,\n headers: StompHeaders = {}\n ): StompSubscription {\n return this._stompHandler.subscribe(destination, callback, headers);\n }\n\n /**\n * It is preferable to unsubscribe from a subscription by calling\n * `unsubscribe()` directly on {@link StompSubscription} returned by `client.subscribe()`:\n *\n * ```javascript\n * var subscription = client.subscribe(destination, onmessage);\n * // ...\n * subscription.unsubscribe();\n * ```\n *\n * See: http://stomp.github.com/stomp-specification-1.2.html#UNSUBSCRIBE UNSUBSCRIBE Frame\n */\n public unsubscribe(id: string, headers: StompHeaders = {}): void {\n this._stompHandler.unsubscribe(id, headers);\n }\n\n /**\n * Start a transaction, the returned {@link ITransaction} has methods - [commit]{@link ITransaction#commit}\n * and [abort]{@link ITransaction#abort}.\n *\n * `transactionId` is optional, if not passed the library will generate it internally.\n */\n public begin(transactionId?: string): ITransaction {\n return this._stompHandler.begin(transactionId);\n }\n\n /**\n * Commit a transaction.\n *\n * It is preferable to commit a transaction by calling [commit]{@link ITransaction#commit} directly on\n * {@link ITransaction} returned by [client.begin]{@link Client#begin}.\n *\n * ```javascript\n * var tx = client.begin(txId);\n * //...\n * tx.commit();\n * ```\n */\n public commit(transactionId: string): void {\n this._stompHandler.commit(transactionId);\n }\n\n /**\n * Abort a transaction.\n * It is preferable to abort a transaction by calling [abort]{@link ITransaction#abort} directly on\n * {@link ITransaction} returned by [client.begin]{@link Client#begin}.\n *\n * ```javascript\n * var tx = client.begin(txId);\n * //...\n * tx.abort();\n * ```\n */\n public abort(transactionId: string): void {\n this._stompHandler.abort(transactionId);\n }\n\n /**\n * ACK a message. It is preferable to acknowledge a message by calling [ack]{@link IMessage#ack} directly\n * on the {@link IMessage} handled by a subscription callback:\n *\n * ```javascript\n * var callback = function (message) {\n * // process the message\n * // acknowledge it\n * message.ack();\n * };\n * client.subscribe(destination, callback, {'ack': 'client'});\n * ```\n */\n public ack(\n messageId: string,\n subscriptionId: string,\n headers: StompHeaders = {}\n ): void {\n this._stompHandler.ack(messageId, subscriptionId, headers);\n }\n\n /**\n * NACK a message. It is preferable to acknowledge a message by calling [nack]{@link IMessage#nack} directly\n * on the {@link IMessage} handled by a subscription callback:\n *\n * ```javascript\n * var callback = function (message) {\n * // process the message\n * // an error occurs, nack it\n * message.nack();\n * };\n * client.subscribe(destination, callback, {'ack': 'client'});\n * ```\n */\n public nack(\n messageId: string,\n subscriptionId: string,\n headers: StompHeaders = {}\n ): void {\n this._stompHandler.nack(messageId, subscriptionId, headers);\n }\n}\n","import { StompHeaders } from './stomp-headers';\nimport {\n ActivationState,\n closeEventCallbackType,\n debugFnType,\n frameCallbackType,\n messageCallbackType,\n wsErrorCallbackType,\n} from './types';\nimport { Versions } from './versions';\n\n/**\n * Configuration options for STOMP Client, each key corresponds to\n * field by the same name in {@link Client}. This can be passed to\n * the constructor of {@link Client} or to [Client#configure]{@link Client#configure}.\n *\n * There used to be a class with the same name in `@stomp/ng2-stompjs`, which has been replaced by\n * {@link RxStompConfig} and {@link InjectableRxStompConfig}.\n *\n * Part of `@stomp/stompjs`.\n */\nexport class StompConfig {\n /**\n * See [Client#brokerURL]{@link Client#brokerURL}.\n */\n public brokerURL?: string;\n\n /**\n * See See [Client#stompVersions]{@link Client#stompVersions}.\n */\n public stompVersions?: Versions;\n\n /**\n * See [Client#webSocketFactory]{@link Client#webSocketFactory}.\n */\n public webSocketFactory?: () => any;\n\n /**\n * See [Client#connectionTimeout]{@link Client#connectionTimeout}.\n */\n public connectionTimeout?: number;\n\n /**\n * See [Client#reconnectDelay]{@link Client#reconnectDelay}.\n */\n public reconnectDelay?: number;\n\n /**\n * See [Client#heartbeatIncoming]{@link Client#heartbeatIncoming}.\n */\n public heartbeatIncoming?: number;\n\n /**\n * See [Client#heartbeatOutgoing]{@link Client#heartbeatOutgoing}.\n */\n public heartbeatOutgoing?: number;\n\n /**\n * See [Client#splitLargeFrames]{@link Client#splitLargeFrames}.\n */\n public splitLargeFrames?: boolean;\n\n /**\n * See [Client#forceBinaryWSFrames]{@link Client#forceBinaryWSFrames}.\n */\n public forceBinaryWSFrames?: boolean;\n\n /**\n * See [Client#appendMissingNULLonIncoming]{@link Client#appendMissingNULLonIncoming}.\n */\n public appendMissingNULLonIncoming?: boolean;\n\n /**\n * See [Client#maxWebSocketChunkSize]{@link Client#maxWebSocketChunkSize}.\n */\n public maxWebSocketChunkSize?: number;\n\n /**\n * See [Client#connectHeaders]{@link Client#connectHeaders}.\n */\n public connectHeaders?: StompHeaders;\n\n /**\n * See [Client#disconnectHeaders]{@link Client#disconnectHeaders}.\n */\n public disconnectHeaders?: StompHeaders;\n\n /**\n * See [Client#onUnhandledMessage]{@link Client#onUnhandledMessage}.\n */\n public onUnhandledMessage?: messageCallbackType;\n\n /**\n * See [Client#onUnhandledReceipt]{@link Client#onUnhandledReceipt}.\n */\n public onUnhandledReceipt?: frameCallbackType;\n\n /**\n * See [Client#onUnhandledFrame]{@link Client#onUnhandledFrame}.\n */\n public onUnhandledFrame?: frameCallbackType;\n\n /**\n * See [Client#beforeConnect]{@link Client#beforeConnect}.\n */\n public beforeConnect?: () => void | Promise<void>;\n\n /**\n * See [Client#onConnect]{@link Client#onConnect}.\n */\n public onConnect?: frameCallbackType;\n\n /**\n * See [Client#onDisconnect]{@link Client#onDisconnect}.\n */\n public onDisconnect?: frameCallbackType;\n\n /**\n * See [Client#onStompError]{@link Client#onStompError}.\n */\n public onStompError?: frameCallbackType;\n\n /**\n * See [Client#onWebSocketClose]{@link Client#onWebSocketClose}.\n */\n public onWebSocketClose?: closeEventCallbackType;\n\n /**\n * See [Client#onWebSocketError]{@link Client#onWebSocketError}.\n */\n public onWebSocketError?: wsErrorCallbackType;\n\n /**\n * See [Client#logRawCommunication]{@link Client#logRawCommunication}.\n */\n public logRawCommunication?: boolean;\n\n /**\n * See [Client#debug]{@link Client#debug}.\n */\n public debug?: debugFnType;\n\n /**\n * See [Client#discardWebsocketOnCommFailure]{@link Client#discardWebsocketOnCommFailure}.\n */\n public discardWebsocketOnCommFailure?: boolean;\n\n /**\n * See [Client#onChangeState]{@link Client#onChangeState}.\n */\n public onChangeState?: (state: ActivationState) => void;\n}\n","/**\n * STOMP headers. Many functions calls will accept headers as parameters.\n * The headers sent by Broker will be available as [IFrame#headers]{@link IFrame#headers}.\n *\n * `key` and `value` must be valid strings.\n * In addition, `key` must not contain `CR`, `LF`, or `:`.\n *\n * Part of `@stomp/stompjs`.\n */\nexport class StompHeaders {\n [key: string]: string;\n}\n","import { StompHeaders } from './stomp-headers';\n\n/**\n * Call [Client#subscribe]{@link Client#subscribe} to create a StompSubscription.\n *\n * Part of `@stomp/stompjs`.\n */\nexport class StompSubscription {\n /**\n * Id associated with this subscription.\n */\n public id: string;\n\n /**\n * Unsubscribe. See [Client#unsubscribe]{@link Client#unsubscribe} for an example.\n */\n public unsubscribe: (headers?: StompHeaders) => void;\n}\n","import { CompatClient } from './compat-client';\n\n/**\n * Part of `@stomp/stompjs`.\n *\n * @internal\n */\nexport class HeartbeatInfo {\n constructor(private client: CompatClient) {}\n\n get outgoing(): number {\n return this.client.heartbeatOutgoing;\n }\n\n set outgoing(value: number) {\n this.client.heartbeatOutgoing = value;\n }\n\n get incoming(): number {\n return this.client.heartbeatIncoming;\n }\n\n set incoming(value: number) {\n this.client.heartbeatIncoming = value;\n }\n}\n","import { Client } from '../client';\nimport { StompHeaders } from '../stomp-headers';\nimport { frameCallbackType, messageCallbackType } from '../types';\nimport { HeartbeatInfo } from './heartbeat-info';\n\n/**\n * Available for backward compatibility, please shift to using {@link Client}.\n *\n * **Deprecated**\n *\n * Part of `@stomp/stompjs`.\n *\n * To upgrade, please follow the [Upgrade Guide](../additional-documentation/upgrading.html)\n */\nexport class CompatClient extends Client {\n /**\n * It is no op now. No longer needed. Large packets work out of the box.\n */\n public maxWebSocketFrameSize: number = 16 * 1024;\n\n /**\n * Available for backward compatibility, please shift to using {@link Client}\n * and [Client#webSocketFactory]{@link Client#webSocketFactory}.\n *\n * **Deprecated**\n *\n * @internal\n */\n constructor(webSocketFactory: () => any) {\n super();\n this.reconnect_delay = 0;\n this.webSocketFactory = webSocketFactory;\n // Default from previous version\n this.debug = (...message: any[]) => {\n console.log(...message);\n };\n }\n\n private _parseConnect(...args: any[]): any {\n let closeEventCallback;\n let connectCallback;\n let errorCallback;\n let headers: StompHeaders = {};\n if (args.length < 2) {\n throw new Error('Connect requires at least 2 arguments');\n }\n if (typeof args[1] === 'function') {\n [headers, connectCallback, errorCallback, closeEventCallback] = args;\n } else {\n switch (args.length) {\n case 6:\n [\n headers.login,\n headers.passcode,\n connectCallback,\n errorCallback,\n closeEventCallback,\n headers.host,\n ] = args;\n break;\n default:\n [\n headers.login,\n headers.passcode,\n connectCallback,\n errorCallback,\n closeEventCallback,\n ] = args;\n }\n }\n\n return [headers, connectCallback, errorCallback, closeEventCallback];\n }\n\n /**\n * Available for backward compatibility, please shift to using [Client#activate]{@link Client#activate}.\n *\n * **Deprecated**\n *\n * The `connect` method accepts different number of arguments and types. See the Overloads list. Use the\n * version with headers to pass your broker specific options.\n *\n * overloads:\n * - connect(headers, connectCallback)\n * - connect(headers, connectCallback, errorCallback)\n * - connect(login, passcode, connectCallback)\n * - connect(login, passcode, connectCallback, errorCallback)\n * - connect(login, passcode, connectCallback, errorCallback, closeEventCallback)\n * - connect(login, passcode, connectCallback, errorCallback, closeEventCallback, host)\n *\n * params:\n * - headers, see [Client#connectHeaders]{@link Client#connectHeaders}\n * - connectCallback, see [Client#onConnect]{@link Client#onConnect}\n * - errorCallback, see [Client#onStompError]{@link Client#onStompError}\n * - closeEventCallback, see [Client#onWebSocketClose]{@link Client#onWebSocketClose}\n * - login [String], see [Client#connectHeaders](../classes/Client.html#connectHeaders)\n * - passcode [String], [Client#connectHeaders](../classes/Client.html#connectHeaders)\n * - host [String], see [Client#connectHeaders](../classes/Client.html#connectHeaders)\n *\n * To upgrade, please follow the [Upgrade Guide](../additional-documentation/upgrading.html)\n */\n public connect(...args: any[]): void {\n const out = this._parseConnect(...args);\n\n if (out[0]) {\n this.connectHeaders = out[0];\n }\n if (out[1]) {\n this.onConnect = out[1];\n }\n if (out[2]) {\n this.onStompError = out[2];\n }\n if (out[3]) {\n this.onWebSocketClose = out[3];\n }\n\n super.activate();\n }\n\n /**\n * Available for backward compatibility, please shift to using [Client#deactivate]{@link Client#deactivate}.\n *\n * **Deprecated**\n *\n * See:\n * [Client#onDisconnect]{@link Client#onDisconnect}, and\n * [Client#disconnectHeaders]{@link Client#disconnectHeaders}\n *\n * To upgrade, please follow the [Upgrade Guide](../additional-documentation/upgrading.html)\n */\n public disconnect(\n disconnectCallback?: any,\n headers: StompHeaders = {}\n ): void {\n if (disconnectCallback) {\n this.onDisconnect = disconnectCallback;\n }\n this.disconnectHeaders = headers;\n\n super.deactivate();\n }\n\n /**\n * Available for backward compatibility, use [Client#publish]{@link Client#publish}.\n *\n * Send a message to a named destination. Refer to your STOMP broker documentation for types\n * and naming of destinations. The headers will, typically, be available to the subscriber.\n * However, there may be special purpose headers corresponding to your STOMP broker.\n *\n * **Deprecated**, use [Client#publish]{@link Client#publish}\n *\n * Note: Body must be String. You will need to covert the payload to string in case it is not string (e.g. JSON)\n *\n * ```javascript\n * client.send(\"/queue/test\", {priority: 9}, \"Hello, STOMP\");\n *\n * // If you want to send a message with a body, you must also pass the headers argument.\n * client.send(\"/queue/test\", {}, \"Hello, STOMP\");\n * ```\n *\n * To upgrade, please follow the [Upgrade Guide](../additional-documentation/upgrading.html)\n */\n public send(\n destination: string,\n headers: { [key: string]: any } = {},\n body: string = ''\n ): void {\n headers = (Object as any).assign({}, headers);\n\n const skipContentLengthHeader = headers['content-length'] === false;\n if (skipContentLengthHeader) {\n delete headers['content-length'];\n }\n this.publish({\n destination,\n headers: headers as StompHeaders,\n body,\n skipContentLengthHeader,\n });\n }\n\n /**\n * Available for backward compatibility, renamed to [Client#reconnectDelay]{@link Client#reconnectDelay}.\n *\n * **Deprecated**\n */\n set reconnect_delay(value: number) {\n this.reconnectDelay = value;\n }\n\n /**\n * Available for backward compatibility, renamed to [Client#webSocket]{@link Client#webSocket}.\n *\n * **Deprecated**\n */\n get ws(): any {\n return this.webSocket;\n }\n\n /**\n * Available for backward compatibility, renamed to [Client#connectedVersion]{@link Client#connectedVersion}.\n *\n * **Deprecated**\n */\n get version() {\n return this.connectedVersion;\n }\n\n /**\n * Available for backward compatibility, renamed to [Client#onUnhandledMessage]{@link Client#onUnhandledMessage}.\n *\n * **Deprecated**\n */\n get onreceive(): messageCallbackType {\n return this.onUnhandledMessage;\n }\n\n /**\n * Available for backward compatibility, renamed to [Client#onUnhandledMessage]{@link Client#onUnhandledMessage}.\n *\n * **Deprecated**\n */\n set onreceive(value: messageCallbackType) {\n this.onUnhandledMessage = value;\n }\n\n /**\n * Available for backward compatibility, renamed to [Client#onUnhandledReceipt]{@link Client#onUnhandledReceipt}.\n * Prefer using [Client#watchForReceipt]{@link Client#watchForReceipt}.\n *\n * **Deprecated**\n */\n get onreceipt(): frameCallbackType {\n return this.onUnhandledReceipt;\n }\n\n /**\n * Available for backward compatibility, renamed to [Client#onUnhandledReceipt]{@link Client#onUnhandledReceipt}.\n *\n * **Deprecated**\n */\n set onreceipt(value: frameCallbackType) {\n this.onUnhandledReceipt = value;\n }\n\n private _heartbeatInfo: HeartbeatInfo = new HeartbeatInfo(this);\n\n /**\n * Available for backward compatibility, renamed to [Client#heartbeatIncoming]{@link Client#heartbeatIncoming}\n * [Client#heartbeatOutgoing]{@link Client#heartbeatOutgoing}.\n *\n * **Deprecated**\n */\n get heartbeat() {\n return this._heartbeatInfo;\n }\n\n /**\n * Available for backward compatibility, renamed to [Client#heartbeatIncoming]{@link Client#heartbeatIncoming}\n * [Client#heartbeatOutgoing]{@link Client#heartbeatOutgoing}.\n *\n * **Deprecated**\n */\n set heartbeat(value: { incoming: number; outgoing: number }) {\n this.heartbeatIncoming = value.incoming;\n this.heartbeatOutgoing = value.outgoing;\n }\n}\n","import { Versions } from '../versions';\nimport { CompatClient } from './compat-client';\nimport { IStompSocket } from '../types';\n\n/**\n * @internal\n */\ndeclare const WebSocket: {\n prototype: IStompSocket;\n new (url: string, protocols?: string | string[]): IStompSocket;\n};\n\n/**\n * STOMP Class, acts like a factory to create {@link Client}.\n *\n * Part of `@stomp/stompjs`.\n *\n * **Deprecated**\n *\n * It will be removed in next major version. Please switch to {@link Client}.\n */\nexport class Stomp {\n /**\n * In case you need to use a non standard class for WebSocket.\n *\n * For example when using within NodeJS environment:\n *\n * ```javascript\n * StompJs = require('../../esm5/');\n * Stomp = StompJs.Stomp;\n * Stomp.WebSocketClass = require('websocket').w3cwebsocket;\n * ```\n *\n * **Deprecated**\n *\n *\n * It will be removed in next major version. Please switch to {@link Client}\n * using [Client#webSocketFactory]{@link Client#webSocketFactory}.\n */\n // tslint:disable-next-line:variable-name\n public static WebSocketClass: any = null;\n\n /**\n * This method creates a WebSocket client that is connected to\n * the STOMP server located at the url.\n *\n * ```javascript\n * var url = \"ws://localhost:61614/stomp\";\n * var client = Stomp.client(url);\n * ```\n *\n * **Deprecated**\n *\n * It will be removed in next major version. Please switch to {@link Client}\n * using [Client#brokerURL]{@link Client#brokerURL}.\n */\n public static client(url: string, protocols?: string[]): CompatClient {\n // This is a hack to allow another implementation than the standard\n // HTML5 WebSocket class.\n //\n // It is possible to use another class by calling\n //\n // Stomp.WebSocketClass = MozWebSocket\n //\n // *prior* to call `Stomp.client()`.\n //\n // This hack is deprecated and `Stomp.over()` method should be used\n // instead.\n\n // See remarks on the function Stomp.over\n if (protocols == null) {\n protocols = Versions.default.protocolVersions();\n }\n const wsFn = () => {\n const klass = Stomp.WebSocketClass || WebSocket;\n return new klass(url, protocols);\n };\n\n return new CompatClient(wsFn);\n }\n\n /**\n * This method is an alternative to [Stomp#client]{@link Stomp#client} to let the user\n * specify the WebSocket to use (either a standard HTML5 WebSocket or\n * a similar object).\n *\n * In order to support reconnection, the function Client._connect should be callable more than once.\n * While reconnecting\n * a new instance of underlying transport (TCP Socket, WebSocket or SockJS) will be needed. So, this function\n * alternatively allows passing a function that should return a new instance of the underlying socket.\n *\n * ```javascript\n * var client = Stomp.over(function(){\n * return new WebSocket('ws://localhost:15674/ws')\n * });\n * ```\n *\n * **Deprecated**\n *\n * It will be removed in next major version. Please switch to {@link Client}\n * using [Client#webSocketFactory]{@link Client#webSocketFactory}.\n */\n public static over(ws: any): CompatClient {\n let wsFn: () => any;\n\n if (typeof ws === 'function') {\n wsFn = ws;\n } else {\n console.warn(\n 'Stomp.over did not receive a factory, auto reconnect will not work. ' +\n 'Please see https://stomp-js.github.io/api-docs/latest/classes/Stomp.html#over'\n );\n wsFn = () => ws;\n }\n\n return new CompatClient(wsFn);\n }\n}\n"],"sourceRoot":""}
1
+ {"version":3,"sources":["webpack://StompJs/webpack/universalModuleDefinition","webpack://StompJs/webpack/bootstrap","webpack://StompJs/./src/byte.ts","webpack://StompJs/./src/frame-impl.ts","webpack://StompJs/./src/parser.ts","webpack://StompJs/./src/types.ts","webpack://StompJs/./src/versions.ts","webpack://StompJs/./src/stomp-handler.ts","webpack://StompJs/./src/augment-websocket.ts","webpack://StompJs/./src/client.ts","webpack://StompJs/./src/stomp-config.ts","webpack://StompJs/./src/stomp-headers.ts","webpack://StompJs/./src/stomp-subscription.ts","webpack://StompJs/./src/compatibility/heartbeat-info.ts","webpack://StompJs/./src/compatibility/compat-client.ts","webpack://StompJs/./src/compatibility/stomp.ts"],"names":["root","factory","exports","module","define","amd","self","this","installedModules","__webpack_require__","moduleId","i","l","modules","call","m","c","d","name","getter","o","Object","defineProperty","enumerable","get","r","Symbol","toStringTag","value","t","mode","__esModule","ns","create","key","bind","n","object","property","prototype","hasOwnProperty","p","s","BYTE","params","command","headers","body","binaryBody","escapeHeaderValues","skipContentLengthHeader","assign","_binaryBody","isBinaryBody","_body","TextDecoder","decode","TextEncoder","encode","rawFrame","trim","str","replace","header","reverse","indexOf","hdrValueUnEscape","serializeCmdAndHeaders","cmdAndHeaders","toUnit8Array","buffer","lines","keys","push","hdrValueEscape","isBodyEmpty","bodyLength","join","length","uint8CmdAndHeaders","nullTerminator","Uint8Array","uint8Frame","set","serialize","Parser","onFrame","onIncomingPing","_encoder","_decoder","_token","_initState","segment","appendMissingNULLonIncoming","chunk","ArrayBuffer","chunkWithNull","byte","_onByte","_collectCommand","_reinjectByte","_results","_consumeTokenAsUTF8","_collectHeaders","_consumeByte","_collectHeaderKey","_setupCollectBody","_headerKey","_collectHeaderValue","undefined","contentLengthHeader","filter","_bodyBytesRemaining","parseInt","_collectBodyFixedSize","_collectBodyNullTerminated","_retrievedBody","_consumeTokenAsRaw","rawResult","_collectFrame","StompSocketState","ActivationState","Versions","versions","map","x","V1_0","V1_1","V1_2","default","_client","_webSocket","config","_serverFrameHandlers","CONNECTED","frame","debug","server","_connected","_connectedVersion","version","_escapeHeaderValues","_setupHeartbeat","onConnect","MESSAGE","subscription","onReceive","_subscriptions","onUnhandledMessage","message","client","messageId","ack","nack","RECEIPT","callback","_receiptWatchers","onUnhandledReceipt","ERROR","onStompError","_counter","_partialData","_lastServerActivityTS","Date","now","configure","conf","parser","fromRawFrame","logRawCommunication","onUnhandledFrame","onmessage","evt","rawChunkAsString","data","parseChunk","_onclose","closeEvent","brokerURL","_cleanUp","onWebSocketClose","onclose","onerror","errorEvent","onWebSocketError","onopen","connectHeaders","stompVersions","supportedVersions","heartbeatOutgoing","heartbeatIncoming","_transmit","serverOutgoing","serverIncoming","split","v","ttl","Math","max","_pinger","setInterval","readyState","OPEN","send","_ponger","delta","_closeOrDiscardWebsocket","discardWebsocketOnCommFailure","_discardWebsocket","_closeWebsocket","CONNECTING","close","webSocket","terminate","msg","noOp","ts","origOnClose","delay","getTime","code","reason","wasClean","rawChunk","forceBinaryWSFrames","splitLargeFrames","out","substring","maxWebSocketChunkSize","connected","disconnectHeaders","receipt","watchForReceipt","onDisconnect","error","clearInterval","destination","hdrs","receiptId","id","unsubscribe","transactionId","txId","transaction","commit","abort","subscriptionId","connectionTimeout","reconnectDelay","state","INACTIVE","beforeConnect","onChangeState","_disconnectHeaders","_stompHandler","connectedVersion","ACTIVE","DEACTIVATING","Error","active","_changeState","_connect","_connectionWatcher","setTimeout","forceDisconnect","_createWebSocket","clearTimeout","_disposeStompHandler","_resolveSocketClose","_schedule_reconnect","start","webSocketFactory","WebSocket","protocolVersions","binaryType","_reconnector","retPromise","Promise","resolve","CLOSED","reject","dispose","publish","subscribe","begin","StompConfig","StompHeaders","StompSubscription","HeartbeatInfo","super","maxWebSocketFrameSize","_heartbeatInfo","reconnect_delay","console","log","args","closeEventCallback","connectCallback","errorCallback","login","passcode","host","_parseConnect","activate","disconnectCallback","deactivate","incoming","outgoing","url","protocols","WebSocketClass","ws","wsFn","warn"],"mappings":"CAAA,SAA2CA,EAAMC,GAC1B,iBAAZC,SAA0C,iBAAXC,OACxCA,OAAOD,QAAUD,IACQ,mBAAXG,QAAyBA,OAAOC,IAC9CD,OAAO,UAAW,GAAIH,GACI,iBAAZC,QACdA,QAAiB,QAAID,IAErBD,EAAc,QAAIC,IARpB,CASmB,oBAATK,KAAuBA,KAAOC,MAAM,WAC9C,O,YCTE,IAAIC,EAAmB,GAGvB,SAASC,EAAoBC,GAG5B,GAAGF,EAAiBE,GACnB,OAAOF,EAAiBE,GAAUR,QAGnC,IAAIC,EAASK,EAAiBE,GAAY,CACzCC,EAAGD,EACHE,GAAG,EACHV,QAAS,IAUV,OANAW,EAAQH,GAAUI,KAAKX,EAAOD,QAASC,EAAQA,EAAOD,QAASO,GAG/DN,EAAOS,GAAI,EAGJT,EAAOD,QA0Df,OArDAO,EAAoBM,EAAIF,EAGxBJ,EAAoBO,EAAIR,EAGxBC,EAAoBQ,EAAI,SAASf,EAASgB,EAAMC,GAC3CV,EAAoBW,EAAElB,EAASgB,IAClCG,OAAOC,eAAepB,EAASgB,EAAM,CAAEK,YAAY,EAAMC,IAAKL,KAKhEV,EAAoBgB,EAAI,SAASvB,GACX,oBAAXwB,QAA0BA,OAAOC,aAC1CN,OAAOC,eAAepB,EAASwB,OAAOC,YAAa,CAAEC,MAAO,WAE7DP,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,SACE,OAAOrB,KAAK6M,UAQd,cACE,OAAO7M,KAAKwP,iBAQd,gBACE,OAAOxP,KAAK6I,mBAQd,cAAcxH,GACZrB,KAAK6I,mBAAqBxH,EAS5B,gBACE,OAAOrB,KAAKsJ,mBAQd,cAAcjI,GACZrB,KAAKsJ,mBAAqBjI,EAW5B,gBACE,OAAOrB,KAAK4R,eASd,cAAcvQ,GACZrB,KAAKuL,kBAAoBlK,EAAMsR,SAC/B3S,KAAKsL,kBAAoBjK,EAAMuR,UCrP5B,MAAM,EAmCJ,cAAcC,EAAaC,GAcf,MAAbA,IACFA,EAAY3L,EAASO,QAAQgJ,oBAO/B,OAAO,IAAI,EALE,IAEJ,IADO,EAAMqC,gBAAkBtC,WACrBoC,EAAKC,IA2BnB,YAAYE,GACjB,IAAIC,EAYJ,MAVkB,mBAAPD,EACTC,EAAOD,GAEPlB,QAAQoB,KACN,qJAGFD,EAAO,IAAMD,GAGR,IAAI,EAAaC,IA3EZ,EAAAF,eAAsB","file":"stomp.umd.min.js","sourcesContent":["(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory();\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine(\"StompJs\", [], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"StompJs\"] = factory();\n\telse\n\t\troot[\"StompJs\"] = factory();\n})(typeof self !== 'undefined' ? self : this, function() {\nreturn "," \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, { enumerable: true, get: getter });\n \t\t}\n \t};\n\n \t// define __esModule on exports\n \t__webpack_require__.r = function(exports) {\n \t\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n \t\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n \t\t}\n \t\tObject.defineProperty(exports, '__esModule', { value: true });\n \t};\n\n \t// create a fake namespace object\n \t// mode & 1: value is a module id, require it\n \t// mode & 2: merge all properties of value into the ns\n \t// mode & 4: return value when already ns object\n \t// mode & 8|1: behave like require\n \t__webpack_require__.t = function(value, mode) {\n \t\tif(mode & 1) value = __webpack_require__(value);\n \t\tif(mode & 8) return value;\n \t\tif((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;\n \t\tvar ns = Object.create(null);\n \t\t__webpack_require__.r(ns);\n \t\tObject.defineProperty(ns, 'default', { enumerable: true, value: value });\n \t\tif(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));\n \t\treturn ns;\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 0);\n","/**\n * Some byte values, used as per STOMP specifications.\n *\n * Part of `@stomp/stompjs`.\n *\n * @internal\n */\nexport const BYTE = {\n // LINEFEED byte (octet 10)\n LF: '\\x0A',\n // NULL byte (octet 0)\n NULL: '\\x00',\n};\n","import { BYTE } from './byte';\nimport { IFrame } from './i-frame';\nimport { StompHeaders } from './stomp-headers';\nimport { IRawFrameType } from './types';\n\n/**\n * Frame class represents a STOMP frame.\n *\n * @internal\n */\nexport class FrameImpl implements IFrame {\n /**\n * STOMP Command\n */\n public command: string;\n\n /**\n * Headers, key value pairs.\n */\n public headers: StompHeaders;\n\n /**\n * Is this frame binary (based on whether body/binaryBody was passed when creating this frame).\n */\n public isBinaryBody: boolean;\n\n /**\n * body of the frame\n */\n get body(): string {\n if (!this._body && this.isBinaryBody) {\n this._body = new TextDecoder().decode(this._binaryBody);\n }\n return this._body;\n }\n private _body: string;\n\n /**\n * body as Uint8Array\n */\n get binaryBody(): Uint8Array {\n if (!this._binaryBody && !this.isBinaryBody) {\n this._binaryBody = new TextEncoder().encode(this._body);\n }\n return this._binaryBody;\n }\n private _binaryBody: Uint8Array;\n\n private escapeHeaderValues: boolean;\n private skipContentLengthHeader: boolean;\n\n /**\n * Frame constructor. `command`, `headers` and `body` are available as properties.\n *\n * @internal\n */\n constructor(params: {\n command: string;\n headers?: StompHeaders;\n body?: string;\n binaryBody?: Uint8Array;\n escapeHeaderValues?: boolean;\n skipContentLengthHeader?: boolean;\n }) {\n const {\n command,\n headers,\n body,\n binaryBody,\n escapeHeaderValues,\n skipContentLengthHeader,\n } = params;\n this.command = command;\n this.headers = (Object as any).assign({}, headers || {});\n\n if (binaryBody) {\n this._binaryBody = binaryBody;\n this.isBinaryBody = true;\n } else {\n this._body = body || '';\n this.isBinaryBody = false;\n }\n this.escapeHeaderValues = escapeHeaderValues || false;\n this.skipContentLengthHeader = skipContentLengthHeader || false;\n }\n\n /**\n * deserialize a STOMP Frame from raw data.\n *\n * @internal\n */\n public static fromRawFrame(\n rawFrame: IRawFrameType,\n escapeHeaderValues: boolean\n ): FrameImpl {\n const headers: StompHeaders = {};\n const trim = (str: string): string => str.replace(/^\\s+|\\s+$/g, '');\n\n // In case of repeated headers, as per standards, first value need to be used\n for (const header of rawFrame.headers.reverse()) {\n const idx = header.indexOf(':');\n\n const key = trim(header[0]);\n let value = trim(header[1]);\n\n if (\n escapeHeaderValues &&\n rawFrame.command !== 'CONNECT' &&\n rawFrame.command !== 'CONNECTED'\n ) {\n value = FrameImpl.hdrValueUnEscape(value);\n }\n\n headers[key] = value;\n }\n\n return new FrameImpl({\n command: rawFrame.command,\n headers,\n binaryBody: rawFrame.binaryBody,\n escapeHeaderValues,\n });\n }\n\n /**\n * @internal\n */\n public toString(): string {\n return this.serializeCmdAndHeaders();\n }\n\n /**\n * serialize this Frame in a format suitable to be passed to WebSocket.\n * If the body is string the output will be string.\n * If the body is binary (i.e. of type Unit8Array) it will be serialized to ArrayBuffer.\n *\n * @internal\n */\n public serialize(): string | ArrayBuffer {\n const cmdAndHeaders = this.serializeCmdAndHeaders();\n\n if (this.isBinaryBody) {\n return FrameImpl.toUnit8Array(cmdAndHeaders, this._binaryBody).buffer;\n } else {\n return cmdAndHeaders + this._body + BYTE.NULL;\n }\n }\n\n private serializeCmdAndHeaders(): string {\n const lines = [this.command];\n if (this.skipContentLengthHeader) {\n delete this.headers['content-length'];\n }\n\n for (const name of Object.keys(this.headers || {})) {\n const value = this.headers[name];\n if (\n this.escapeHeaderValues &&\n this.command !== 'CONNECT' &&\n this.command !== 'CONNECTED'\n ) {\n lines.push(`${name}:${FrameImpl.hdrValueEscape(`${value}`)}`);\n } else {\n lines.push(`${name}:${value}`);\n }\n }\n if (\n this.isBinaryBody ||\n (!this.isBodyEmpty() && !this.skipContentLengthHeader)\n ) {\n lines.push(`content-length:${this.bodyLength()}`);\n }\n return lines.join(BYTE.LF) + BYTE.LF + BYTE.LF;\n }\n\n private isBodyEmpty(): boolean {\n return this.bodyLength() === 0;\n }\n\n private bodyLength(): number {\n const binaryBody = this.binaryBody;\n return binaryBody ? binaryBody.length : 0;\n }\n\n /**\n * Compute the size of a UTF-8 string by counting its number of bytes\n * (and not the number of characters composing the string)\n */\n private static sizeOfUTF8(s: string): number {\n return s ? new TextEncoder().encode(s).length : 0;\n }\n\n private static toUnit8Array(\n cmdAndHeaders: string,\n binaryBody: Uint8Array\n ): Uint8Array {\n const uint8CmdAndHeaders = new TextEncoder().encode(cmdAndHeaders);\n const nullTerminator = new Uint8Array([0]);\n const uint8Frame = new Uint8Array(\n uint8CmdAndHeaders.length + binaryBody.length + nullTerminator.length\n );\n\n uint8Frame.set(uint8CmdAndHeaders);\n uint8Frame.set(binaryBody, uint8CmdAndHeaders.length);\n uint8Frame.set(\n nullTerminator,\n uint8CmdAndHeaders.length + binaryBody.length\n );\n\n return uint8Frame;\n }\n /**\n * Serialize a STOMP frame as per STOMP standards, suitable to be sent to the STOMP broker.\n *\n * @internal\n */\n public static marshall(params: {\n command: string;\n headers?: StompHeaders;\n body?: string;\n binaryBody?: Uint8Array;\n escapeHeaderValues?: boolean;\n skipContentLengthHeader?: boolean;\n }) {\n const frame = new FrameImpl(params);\n return frame.serialize();\n }\n\n /**\n * Escape header values\n */\n private static hdrValueEscape(str: string): string {\n return str\n .replace(/\\\\/g, '\\\\\\\\')\n .replace(/\\r/g, '\\\\r')\n .replace(/\\n/g, '\\\\n')\n .replace(/:/g, '\\\\c');\n }\n\n /**\n * UnEscape header values\n */\n private static hdrValueUnEscape(str: string): string {\n return str\n .replace(/\\\\r/g, '\\r')\n .replace(/\\\\n/g, '\\n')\n .replace(/\\\\c/g, ':')\n .replace(/\\\\\\\\/g, '\\\\');\n }\n}\n","import { IRawFrameType } from './types';\n\n/**\n * @internal\n */\nconst NULL = 0;\n/**\n * @internal\n */\nconst LF = 10;\n/**\n * @internal\n */\nconst CR = 13;\n/**\n * @internal\n */\nconst COLON = 58;\n\n/**\n * This is an evented, rec descent parser.\n * A stream of Octets can be passed and whenever it recognizes\n * a complete Frame or an incoming ping it will invoke the registered callbacks.\n *\n * All incoming Octets are fed into _onByte function.\n * Depending on current state the _onByte function keeps changing.\n * Depending on the state it keeps accumulating into _token and _results.\n * State is indicated by current value of _onByte, all states are named as _collect.\n *\n * STOMP standards https://stomp.github.io/stomp-specification-1.2.html\n * imply that all lengths are considered in bytes (instead of string lengths).\n * So, before actual parsing, if the incoming data is String it is converted to Octets.\n * This allows faithful implementation of the protocol and allows NULL Octets to be present in the body.\n *\n * There is no peek function on the incoming data.\n * When a state change occurs based on an Octet without consuming the Octet,\n * the Octet, after state change, is fed again (_reinjectByte).\n * This became possible as the state change can be determined by inspecting just one Octet.\n *\n * There are two modes to collect the body, if content-length header is there then it by counting Octets\n * otherwise it is determined by NULL terminator.\n *\n * Following the standards, the command and headers are converted to Strings\n * and the body is returned as Octets.\n * Headers are returned as an array and not as Hash - to allow multiple occurrence of an header.\n *\n * This parser does not use Regular Expressions as that can only operate on Strings.\n *\n * It handles if multiple STOMP frames are given as one chunk, a frame is split into multiple chunks, or\n * any combination there of. The parser remembers its state (any partial frame) and continues when a new chunk\n * is pushed.\n *\n * Typically the higher level function will convert headers to Hash, handle unescaping of header values\n * (which is protocol version specific), and convert body to text.\n *\n * Check the parser.spec.js to understand cases that this parser is supposed to handle.\n *\n * Part of `@stomp/stompjs`.\n *\n * @internal\n */\nexport class Parser {\n private readonly _encoder = new TextEncoder();\n private readonly _decoder = new TextDecoder();\n\n private _results: IRawFrameType;\n\n private _token: number[] = [];\n private _headerKey: string;\n private _bodyBytesRemaining: number;\n\n private _onByte: (byte: number) => void;\n\n public constructor(\n public onFrame: (rawFrame: IRawFrameType) => void,\n public onIncomingPing: () => void\n ) {\n this._initState();\n }\n\n public parseChunk(\n segment: string | ArrayBuffer,\n appendMissingNULLonIncoming: boolean = false\n ) {\n let chunk: Uint8Array;\n\n if (segment instanceof ArrayBuffer) {\n chunk = new Uint8Array(segment);\n } else {\n chunk = this._encoder.encode(segment);\n }\n\n // See https://github.com/stomp-js/stompjs/issues/89\n // Remove when underlying issue is fixed.\n //\n // Send a NULL byte, if the last byte of a Text frame was not NULL.F\n if (appendMissingNULLonIncoming && chunk[chunk.length - 1] !== 0) {\n const chunkWithNull = new Uint8Array(chunk.length + 1);\n chunkWithNull.set(chunk, 0);\n chunkWithNull[chunk.length] = 0;\n chunk = chunkWithNull;\n }\n\n // tslint:disable-next-line:prefer-for-of\n for (let i = 0; i < chunk.length; i++) {\n const byte = chunk[i];\n this._onByte(byte);\n }\n }\n\n // The following implements a simple Rec Descent Parser.\n // The grammar is simple and just one byte tells what should be the next state\n\n private _collectFrame(byte: number): void {\n if (byte === NULL) {\n // Ignore\n return;\n }\n if (byte === CR) {\n // Ignore CR\n return;\n }\n if (byte === LF) {\n // Incoming Ping\n this.onIncomingPing();\n return;\n }\n\n this._onByte = this._collectCommand;\n this._reinjectByte(byte);\n }\n\n private _collectCommand(byte: number): void {\n if (byte === CR) {\n // Ignore CR\n return;\n }\n if (byte === LF) {\n this._results.command = this._consumeTokenAsUTF8();\n this._onByte = this._collectHeaders;\n return;\n }\n\n this._consumeByte(byte);\n }\n\n private _collectHeaders(byte: number): void {\n if (byte === CR) {\n // Ignore CR\n return;\n }\n if (byte === LF) {\n this._setupCollectBody();\n return;\n }\n this._onByte = this._collectHeaderKey;\n this._reinjectByte(byte);\n }\n\n private _reinjectByte(byte: number) {\n this._onByte(byte);\n }\n\n private _collectHeaderKey(byte: number): void {\n if (byte === COLON) {\n this._headerKey = this._consumeTokenAsUTF8();\n this._onByte = this._collectHeaderValue;\n return;\n }\n this._consumeByte(byte);\n }\n\n private _collectHeaderValue(byte: number): void {\n if (byte === CR) {\n // Ignore CR\n return;\n }\n if (byte === LF) {\n this._results.headers.push([this._headerKey, this._consumeTokenAsUTF8()]);\n this._headerKey = undefined;\n this._onByte = this._collectHeaders;\n return;\n }\n this._consumeByte(byte);\n }\n\n private _setupCollectBody() {\n const contentLengthHeader = this._results.headers.filter(\n (header: [string, string]) => {\n return header[0] === 'content-length';\n }\n )[0];\n\n if (contentLengthHeader) {\n this._bodyBytesRemaining = parseInt(contentLengthHeader[1], 10);\n this._onByte = this._collectBodyFixedSize;\n } else {\n this._onByte = this._collectBodyNullTerminated;\n }\n }\n\n private _collectBodyNullTerminated(byte: number): void {\n if (byte === NULL) {\n this._retrievedBody();\n return;\n }\n this._consumeByte(byte);\n }\n\n private _collectBodyFixedSize(byte: number): void {\n // It is post decrement, so that we discard the trailing NULL octet\n if (this._bodyBytesRemaining-- === 0) {\n this._retrievedBody();\n return;\n }\n this._consumeByte(byte);\n }\n\n private _retrievedBody() {\n this._results.binaryBody = this._consumeTokenAsRaw();\n\n this.onFrame(this._results);\n\n this._initState();\n }\n\n // Rec Descent Parser helpers\n\n private _consumeByte(byte: number) {\n this._token.push(byte);\n }\n\n private _consumeTokenAsUTF8() {\n return this._decoder.decode(this._consumeTokenAsRaw());\n }\n\n private _consumeTokenAsRaw() {\n const rawResult = new Uint8Array(this._token);\n this._token = [];\n return rawResult;\n }\n\n private _initState() {\n this._results = {\n command: undefined,\n headers: [],\n binaryBody: undefined,\n };\n\n this._token = [];\n this._headerKey = undefined;\n\n this._onByte = this._collectFrame;\n }\n}\n","import { IFrame } from './i-frame';\nimport { IMessage } from './i-message';\nimport { StompHeaders } from './stomp-headers';\n\n/**\n * This callback will receive a `string` as parameter.\n *\n * Part of `@stomp/stompjs`.\n */\nexport type debugFnType = (msg: string) => void;\n\n/**\n * This callback will receive a {@link IMessage} as parameter.\n *\n * Part of `@stomp/stompjs`.\n */\nexport type messageCallbackType = (message: IMessage) => void;\n\n/**\n * This callback will receive a {@link IFrame} as parameter.\n *\n * Part of `@stomp/stompjs`.\n */\nexport type frameCallbackType = (receipt: IFrame) => void;\n\n/**\n * This callback will receive a [CloseEvent]{@link https://developer.mozilla.org/en-US/docs/Web/API/CloseEvent}\n * as parameter.\n *\n * Part of `@stomp/stompjs`.\n */\nexport type closeEventCallbackType<T = any> = (evt: T) => void;\n\n/**\n * This callback will receive an [Event]{@link https://developer.mozilla.org/en-US/docs/Web/API/Event}\n * as parameter.\n *\n * Part of `@stomp/stompjs`.\n */\nexport type wsErrorCallbackType<T = any> = (evt: T) => void;\n\n/**\n * Parameters for [Client#publish]{@link Client#publish}.\n * Aliased as publishParams as well.\n *\n * Part of `@stomp/stompjs`.\n */\nexport interface IPublishParams {\n /**\n * destination end point\n */\n destination: string;\n /**\n * headers (optional)\n */\n headers?: StompHeaders;\n /**\n * body (optional)\n */\n body?: string;\n /**\n * binary body (optional)\n */\n binaryBody?: Uint8Array;\n /**\n * By default a `content-length` header will be added in the Frame to the broker.\n * Set it to `true` for the header to be skipped.\n */\n skipContentLengthHeader?: boolean;\n}\n\n/**\n * Backward compatibility, switch to {@link IPublishParams}.\n */\nexport type publishParams = IPublishParams;\n\n/**\n * Used in {@link IRawFrameType}\n *\n * Part of `@stomp/stompjs`.\n *\n * @internal\n */\nexport type RawHeaderType = [string, string];\n\n/**\n * The parser yield frames in this structure\n *\n * Part of `@stomp/stompjs`.\n *\n * @internal\n */\nexport interface IRawFrameType {\n command: string;\n headers: RawHeaderType[];\n binaryBody: Uint8Array;\n}\n\n/**\n * @internal\n */\nexport interface IStompSocketMessageEvent {\n data?: string | ArrayBuffer;\n}\n\n/**\n * Copied from Websocket interface to avoid dom typelib dependency.\n *\n * @internal\n */\nexport interface IStompSocket {\n onclose: ((this: IStompSocket, ev?: any) => any) | null;\n onerror: ((this: IStompSocket, ev: any) => any) | null;\n onmessage: ((this: IStompSocket, ev: IStompSocketMessageEvent) => any) | null;\n onopen: ((this: IStompSocket, ev?: any) => any) | null;\n terminate?: ((this: IStompSocket) => any) | null;\n\n /**\n * Returns a string that indicates how binary data from the socket is exposed to scripts:\n * We support only 'arraybuffer'.\n */\n binaryType: 'arraybuffer';\n\n /**\n * Returns the state of the socket connection. It can have the values of StompSocketState.\n */\n readonly readyState: number;\n\n /**\n * Closes the connection.\n */\n close(): void;\n /**\n * Transmits data using the connection. data can be a string or an ArrayBuffer.\n */\n send(data: string | ArrayBuffer): void;\n}\n\n/**\n * Possible states for the IStompSocket\n */\nexport enum StompSocketState {\n CONNECTING,\n OPEN,\n CLOSING,\n CLOSED,\n}\n\n/**\n * Possible activation state\n */\nexport enum ActivationState {\n ACTIVE,\n DEACTIVATING,\n INACTIVE,\n}\n","/**\n * Supported STOMP versions\n *\n * Part of `@stomp/stompjs`.\n */\nexport class Versions {\n /**\n * Indicates protocol version 1.0\n */\n public static V1_0 = '1.0';\n /**\n * Indicates protocol version 1.1\n */\n public static V1_1 = '1.1';\n /**\n * Indicates protocol version 1.2\n */\n public static V1_2 = '1.2';\n\n /**\n * @internal\n */\n public static default = new Versions([\n Versions.V1_0,\n Versions.V1_1,\n Versions.V1_2,\n ]);\n\n /**\n * Takes an array of string of versions, typical elements '1.0', '1.1', or '1.2'\n *\n * You will an instance if this class if you want to override supported versions to be declared during\n * STOMP handshake.\n */\n constructor(public versions: string[]) {}\n\n /**\n * Used as part of CONNECT STOMP Frame\n */\n public supportedVersions() {\n return this.versions.join(',');\n }\n\n /**\n * Used while creating a WebSocket\n */\n public protocolVersions() {\n return this.versions.map(x => `v${x.replace('.', '')}.stomp`);\n }\n}\n","import { BYTE } from './byte';\nimport { Client } from './client';\nimport { FrameImpl } from './frame-impl';\nimport { IMessage } from './i-message';\nimport { ITransaction } from './i-transaction';\nimport { Parser } from './parser';\nimport { StompConfig } from './stomp-config';\nimport { StompHeaders } from './stomp-headers';\nimport { StompSubscription } from './stomp-subscription';\nimport {\n closeEventCallbackType,\n debugFnType,\n frameCallbackType,\n IPublishParams,\n IStompSocket,\n IStompSocketMessageEvent,\n messageCallbackType,\n StompSocketState,\n wsErrorCallbackType,\n} from './types';\nimport { Versions } from './versions';\nimport { augmentWebsocket } from './augment-websocket';\n\n/**\n * The STOMP protocol handler\n *\n * Part of `@stomp/stompjs`.\n *\n * @internal\n */\nexport class StompHandler {\n public debug: debugFnType;\n\n public stompVersions: Versions;\n\n public connectHeaders: StompHeaders;\n\n public disconnectHeaders: StompHeaders;\n\n public heartbeatIncoming: number;\n\n public heartbeatOutgoing: number;\n\n public onUnhandledMessage: messageCallbackType;\n\n public onUnhandledReceipt: frameCallbackType;\n\n public onUnhandledFrame: frameCallbackType;\n\n public onConnect: frameCallbackType;\n\n public onDisconnect: frameCallbackType;\n\n public onStompError: frameCallbackType;\n\n public onWebSocketClose: closeEventCallbackType;\n\n public onWebSocketError: wsErrorCallbackType;\n\n public logRawCommunication: boolean;\n\n public splitLargeFrames: boolean;\n\n public maxWebSocketChunkSize: number;\n\n public forceBinaryWSFrames: boolean;\n\n public appendMissingNULLonIncoming: boolean;\n\n public discardWebsocketOnCommFailure: boolean;\n\n get connectedVersion(): string {\n return this._connectedVersion;\n }\n private _connectedVersion: string;\n\n get connected(): boolean {\n return this._connected;\n }\n\n private _connected: boolean;\n\n private readonly _subscriptions: { [key: string]: messageCallbackType };\n private readonly _receiptWatchers: { [key: string]: frameCallbackType };\n private _partialData: string;\n private _escapeHeaderValues: boolean;\n private _counter: number;\n private _pinger: any;\n private _ponger: any;\n private _lastServerActivityTS: number;\n\n private _onclose: (closeEvent: any) => void;\n\n constructor(\n private _client: Client,\n public _webSocket: IStompSocket,\n config: StompConfig = {}\n ) {\n // used to index subscribers\n this._counter = 0;\n\n // subscription callbacks indexed by subscriber's ID\n this._subscriptions = {};\n\n // receipt-watchers indexed by receipts-ids\n this._receiptWatchers = {};\n\n this._partialData = '';\n\n this._escapeHeaderValues = false;\n\n this._lastServerActivityTS = Date.now();\n\n this.configure(config);\n }\n\n public configure(conf: StompConfig): void {\n // bulk assign all properties to this\n (Object as any).assign(this, conf);\n }\n\n public start(): void {\n const parser = new Parser(\n // On Frame\n rawFrame => {\n const frame = FrameImpl.fromRawFrame(\n rawFrame,\n this._escapeHeaderValues\n );\n\n // if this.logRawCommunication is set, the rawChunk is logged at this._webSocket.onmessage\n if (!this.logRawCommunication) {\n this.debug(`<<< ${frame}`);\n }\n\n const serverFrameHandler =\n this._serverFrameHandlers[frame.command] || this.onUnhandledFrame;\n serverFrameHandler(frame);\n },\n // On Incoming Ping\n () => {\n this.debug('<<< PONG');\n }\n );\n\n this._webSocket.onmessage = (evt: IStompSocketMessageEvent) => {\n this.debug('Received data');\n this._lastServerActivityTS = Date.now();\n\n if (this.logRawCommunication) {\n const rawChunkAsString =\n evt.data instanceof ArrayBuffer\n ? new TextDecoder().decode(evt.data)\n : evt.data;\n this.debug(`<<< ${rawChunkAsString}`);\n }\n\n parser.parseChunk(evt.data, this.appendMissingNULLonIncoming);\n };\n\n this._onclose = (closeEvent): void => {\n this.debug(`Connection closed to ${this._client.brokerURL}`);\n this._cleanUp();\n this.onWebSocketClose(closeEvent);\n };\n\n this._webSocket.onclose = this._onclose;\n\n this._webSocket.onerror = (errorEvent): void => {\n this.onWebSocketError(errorEvent);\n };\n\n this._webSocket.onopen = () => {\n // Clone before updating\n const connectHeaders = (Object as any).assign({}, this.connectHeaders);\n\n this.debug('Web Socket Opened...');\n connectHeaders['accept-version'] = this.stompVersions.supportedVersions();\n connectHeaders['heart-beat'] = [\n this.heartbeatOutgoing,\n this.heartbeatIncoming,\n ].join(',');\n this._transmit({ command: 'CONNECT', headers: connectHeaders });\n };\n }\n\n private readonly _serverFrameHandlers: {\n [key: string]: frameCallbackType;\n } = {\n // [CONNECTED Frame](http://stomp.github.com/stomp-specification-1.2.html#CONNECTED_Frame)\n CONNECTED: frame => {\n this.debug(`connected to server ${frame.headers.server}`);\n this._connected = true;\n this._connectedVersion = frame.headers.version;\n // STOMP version 1.2 needs header values to be escaped\n if (this._connectedVersion === Versions.V1_2) {\n this._escapeHeaderValues = true;\n }\n\n this._setupHeartbeat(frame.headers);\n this.onConnect(frame);\n },\n\n // [MESSAGE Frame](http://stomp.github.com/stomp-specification-1.2.html#MESSAGE)\n MESSAGE: frame => {\n // the callback is registered when the client calls\n // `subscribe()`.\n // If there is no registered subscription for the received message,\n // the default `onUnhandledMessage` callback is used that the client can set.\n // This is useful for subscriptions that are automatically created\n // on the browser side (e.g. [RabbitMQ's temporary\n // queues](http://www.rabbitmq.com/stomp.html)).\n const subscription = frame.headers.subscription;\n const onReceive =\n this._subscriptions[subscription] || this.onUnhandledMessage;\n\n // bless the frame to be a Message\n const message = frame as IMessage;\n\n const client = this;\n const messageId =\n this._connectedVersion === Versions.V1_2\n ? message.headers.ack\n : message.headers['message-id'];\n\n // add `ack()` and `nack()` methods directly to the returned frame\n // so that a simple call to `message.ack()` can acknowledge the message.\n message.ack = (headers: StompHeaders = {}): void => {\n return client.ack(messageId, subscription, headers);\n };\n message.nack = (headers: StompHeaders = {}): void => {\n return client.nack(messageId, subscription, headers);\n };\n onReceive(message);\n },\n\n // [RECEIPT Frame](http://stomp.github.com/stomp-specification-1.2.html#RECEIPT)\n RECEIPT: frame => {\n const callback = this._receiptWatchers[frame.headers['receipt-id']];\n if (callback) {\n callback(frame);\n // Server will acknowledge only once, remove the callback\n delete this._receiptWatchers[frame.headers['receipt-id']];\n } else {\n this.onUnhandledReceipt(frame);\n }\n },\n\n // [ERROR Frame](http://stomp.github.com/stomp-specification-1.2.html#ERROR)\n ERROR: frame => {\n this.onStompError(frame);\n },\n };\n\n private _setupHeartbeat(headers: StompHeaders): void {\n if (\n headers.version !== Versions.V1_1 &&\n headers.version !== Versions.V1_2\n ) {\n return;\n }\n\n // It is valid for the server to not send this header\n // https://stomp.github.io/stomp-specification-1.2.html#Heart-beating\n if (!headers['heart-beat']) {\n return;\n }\n\n // heart-beat header received from the server looks like:\n //\n // heart-beat: sx, sy\n const [serverOutgoing, serverIncoming] = headers['heart-beat']\n .split(',')\n .map((v: string) => parseInt(v, 10));\n\n if (this.heartbeatOutgoing !== 0 && serverIncoming !== 0) {\n const ttl: number = Math.max(this.heartbeatOutgoing, serverIncoming);\n this.debug(`send PING every ${ttl}ms`);\n this._pinger = setInterval(() => {\n if (this._webSocket.readyState === StompSocketState.OPEN) {\n this._webSocket.send(BYTE.LF);\n this.debug('>>> PING');\n }\n }, ttl);\n }\n\n if (this.heartbeatIncoming !== 0 && serverOutgoing !== 0) {\n const ttl: number = Math.max(this.heartbeatIncoming, serverOutgoing);\n this.debug(`check PONG every ${ttl}ms`);\n this._ponger = setInterval(() => {\n const delta = Date.now() - this._lastServerActivityTS;\n // We wait twice the TTL to be flexible on window's setInterval calls\n if (delta > ttl * 2) {\n this.debug(`did not receive server activity for the last ${delta}ms`);\n this._closeOrDiscardWebsocket();\n }\n }, ttl);\n }\n }\n\n private _closeOrDiscardWebsocket() {\n if (this.discardWebsocketOnCommFailure) {\n this.debug(\n \"Discarding websocket, the underlying socket may linger for a while\"\n );\n this._discardWebsocket();\n } else {\n this.debug(\"Issuing close on the websocket\");\n this._closeWebsocket();\n }\n }\n\n public forceDisconnect() {\n if (this._webSocket) {\n if (\n this._webSocket.readyState === StompSocketState.CONNECTING ||\n this._webSocket.readyState === StompSocketState.OPEN\n ) {\n this._closeOrDiscardWebsocket();\n }\n }\n }\n\n public _closeWebsocket() {\n this._webSocket.onmessage = () => {}; // ignore messages\n this._webSocket.close();\n }\n\n private _discardWebsocket() {\n if (!this._webSocket.terminate) {\n augmentWebsocket(this._webSocket, (msg: string) => this.debug(msg));\n }\n\n this._webSocket.terminate();\n }\n\n private _transmit(params: {\n command: string;\n headers?: StompHeaders;\n body?: string;\n binaryBody?: Uint8Array;\n skipContentLengthHeader?: boolean;\n }): void {\n const {\n command,\n headers,\n body,\n binaryBody,\n skipContentLengthHeader,\n } = params;\n const frame = new FrameImpl({\n command,\n headers,\n body,\n binaryBody,\n escapeHeaderValues: this._escapeHeaderValues,\n skipContentLengthHeader,\n });\n\n let rawChunk = frame.serialize();\n\n if (this.logRawCommunication) {\n this.debug(`>>> ${rawChunk}`);\n } else {\n this.debug(`>>> ${frame}`);\n }\n\n if (this.forceBinaryWSFrames && typeof rawChunk === 'string') {\n rawChunk = new TextEncoder().encode(rawChunk);\n }\n\n if (typeof rawChunk !== 'string' || !this.splitLargeFrames) {\n this._webSocket.send(rawChunk);\n } else {\n let out = rawChunk as string;\n while (out.length > 0) {\n const chunk = out.substring(0, this.maxWebSocketChunkSize);\n out = out.substring(this.maxWebSocketChunkSize);\n this._webSocket.send(chunk);\n this.debug(`chunk sent = ${chunk.length}, remaining = ${out.length}`);\n }\n }\n }\n\n public dispose(): void {\n if (this.connected) {\n try {\n // clone before updating\n const disconnectHeaders = (Object as any).assign(\n {},\n this.disconnectHeaders\n );\n\n if (!disconnectHeaders.receipt) {\n disconnectHeaders.receipt = `close-${this._counter++}`;\n }\n this.watchForReceipt(disconnectHeaders.receipt, frame => {\n this._closeWebsocket();\n this._cleanUp();\n this.onDisconnect(frame);\n });\n this._transmit({ command: 'DISCONNECT', headers: disconnectHeaders });\n } catch (error) {\n this.debug(`Ignoring error during disconnect ${error}`);\n }\n } else {\n if (\n this._webSocket.readyState === StompSocketState.CONNECTING ||\n this._webSocket.readyState === StompSocketState.OPEN\n ) {\n this._closeWebsocket();\n }\n }\n }\n\n private _cleanUp() {\n this._connected = false;\n\n if (this._pinger) {\n clearInterval(this._pinger);\n }\n if (this._ponger) {\n clearInterval(this._ponger);\n }\n }\n\n public publish(params: IPublishParams): void {\n const {\n destination,\n headers,\n body,\n binaryBody,\n skipContentLengthHeader,\n } = params;\n const hdrs: StompHeaders = (Object as any).assign({ destination }, headers);\n this._transmit({\n command: 'SEND',\n headers: hdrs,\n body,\n binaryBody,\n skipContentLengthHeader,\n });\n }\n\n public watchForReceipt(receiptId: string, callback: frameCallbackType): void {\n this._receiptWatchers[receiptId] = callback;\n }\n\n public subscribe(\n destination: string,\n callback: messageCallbackType,\n headers: StompHeaders = {}\n ): StompSubscription {\n headers = (Object as any).assign({}, headers);\n\n if (!headers.id) {\n headers.id = `sub-${this._counter++}`;\n }\n headers.destination = destination;\n this._subscriptions[headers.id] = callback;\n this._transmit({ command: 'SUBSCRIBE', headers });\n const client = this;\n return {\n id: headers.id,\n\n unsubscribe(hdrs) {\n return client.unsubscribe(headers.id, hdrs);\n },\n };\n }\n\n public unsubscribe(id: string, headers: StompHeaders = {}): void {\n headers = (Object as any).assign({}, headers);\n\n delete this._subscriptions[id];\n headers.id = id;\n this._transmit({ command: 'UNSUBSCRIBE', headers });\n }\n\n public begin(transactionId: string): ITransaction {\n const txId = transactionId || `tx-${this._counter++}`;\n this._transmit({\n command: 'BEGIN',\n headers: {\n transaction: txId,\n },\n });\n const client = this;\n return {\n id: txId,\n commit(): void {\n client.commit(txId);\n },\n abort(): void {\n client.abort(txId);\n },\n };\n }\n\n public commit(transactionId: string): void {\n this._transmit({\n command: 'COMMIT',\n headers: {\n transaction: transactionId,\n },\n });\n }\n\n public abort(transactionId: string): void {\n this._transmit({\n command: 'ABORT',\n headers: {\n transaction: transactionId,\n },\n });\n }\n\n public ack(\n messageId: string,\n subscriptionId: string,\n headers: StompHeaders = {}\n ): void {\n headers = (Object as any).assign({}, headers);\n\n if (this._connectedVersion === Versions.V1_2) {\n headers.id = messageId;\n } else {\n headers['message-id'] = messageId;\n }\n headers.subscription = subscriptionId;\n this._transmit({ command: 'ACK', headers });\n }\n\n public nack(\n messageId: string,\n subscriptionId: string,\n headers: StompHeaders = {}\n ): void {\n headers = (Object as any).assign({}, headers);\n\n if (this._connectedVersion === Versions.V1_2) {\n headers.id = messageId;\n } else {\n headers['message-id'] = messageId;\n }\n headers.subscription = subscriptionId;\n return this._transmit({ command: 'NACK', headers });\n }\n}\n","import { IStompSocket } from './types';\n\n/**\n * @internal\n */\nexport function augmentWebsocket(\n webSocket: IStompSocket,\n debug: (msg: string) => void\n) {\n webSocket.terminate = function () {\n const noOp = () => {};\n\n // set all callbacks to no op\n this.onerror = noOp;\n this.onmessage = noOp;\n this.onopen = noOp;\n\n const ts = new Date();\n\n const origOnClose = this.onclose;\n\n // Track delay in actual closure of the socket\n this.onclose = closeEvent => {\n const delay = new Date().getTime() - ts.getTime();\n debug(\n `Discarded socket closed after ${delay}ms, with code/reason: ${closeEvent.code}/${closeEvent.reason}`\n );\n };\n\n this.close();\n\n origOnClose.call(this, {\n code: 4001,\n reason: 'Heartbeat failure, discarding the socket',\n wasClean: false,\n });\n };\n}\n","import { ITransaction } from './i-transaction';\nimport { StompConfig } from './stomp-config';\nimport { StompHandler } from './stomp-handler';\nimport { StompHeaders } from './stomp-headers';\nimport { StompSubscription } from './stomp-subscription';\nimport {\n ActivationState,\n closeEventCallbackType,\n debugFnType,\n frameCallbackType,\n IPublishParams,\n IStompSocket,\n messageCallbackType,\n StompSocketState,\n wsErrorCallbackType,\n} from './types';\nimport { Versions } from './versions';\n\n/**\n * @internal\n */\ndeclare const WebSocket: {\n prototype: IStompSocket;\n new (url: string, protocols?: string | string[]): IStompSocket;\n};\n\n/**\n * STOMP Client Class.\n *\n * Part of `@stomp/stompjs`.\n */\nexport class Client {\n /**\n * The URL for the STOMP broker to connect to.\n * Typically like `\"ws://broker.329broker.com:15674/ws\"` or `\"wss://broker.329broker.com:15674/ws\"`.\n *\n * Only one of this or [Client#webSocketFactory]{@link Client#webSocketFactory} need to be set.\n * If both are set, [Client#webSocketFactory]{@link Client#webSocketFactory} will be used.\n *\n * If your environment does not support WebSockets natively, please refer to\n * [Polyfills]{@link https://stomp-js.github.io/guide/stompjs/rx-stomp/ng2-stompjs/pollyfils-for-stompjs-v5.html}.\n */\n public brokerURL: string;\n\n /**\n * STOMP versions to attempt during STOMP handshake. By default versions `1.0`, `1.1`, and `1.2` are attempted.\n *\n * Example:\n * ```javascript\n * // Try only versions 1.0 and 1.1\n * client.stompVersions = new Versions(['1.0', '1.1'])\n * ```\n */\n public stompVersions = Versions.default;\n\n /**\n * This function should return a WebSocket or a similar (e.g. SockJS) object.\n * If your environment does not support WebSockets natively, please refer to\n * [Polyfills]{@link https://stomp-js.github.io/guide/stompjs/rx-stomp/ng2-stompjs/pollyfils-for-stompjs-v5.html}.\n * If your STOMP Broker supports WebSockets, prefer setting [Client#brokerURL]{@link Client#brokerURL}.\n *\n * If both this and [Client#brokerURL]{@link Client#brokerURL} are set, this will be used.\n *\n * Example:\n * ```javascript\n * // use a WebSocket\n * client.webSocketFactory= function () {\n * return new WebSocket(\"wss://broker.329broker.com:15674/ws\");\n * };\n *\n * // Typical usage with SockJS\n * client.webSocketFactory= function () {\n * return new SockJS(\"http://broker.329broker.com/stomp\");\n * };\n * ```\n */\n public webSocketFactory: () => IStompSocket;\n\n /**\n * Will retry if Stomp connection is not established in specified milliseconds.\n * Default 0, which implies wait for ever.\n */\n public connectionTimeout: number = 0;\n\n private _connectionWatcher: number; // Timer\n\n /**\n * automatically reconnect with delay in milliseconds, set to 0 to disable.\n */\n public reconnectDelay: number = 5000;\n\n /**\n * Incoming heartbeat interval in milliseconds. Set to 0 to disable.\n */\n public heartbeatIncoming: number = 10000;\n\n /**\n * Outgoing heartbeat interval in milliseconds. Set to 0 to disable.\n */\n public heartbeatOutgoing: number = 10000;\n\n /**\n * This switches on a non standard behavior while sending WebSocket packets.\n * It splits larger (text) packets into chunks of [maxWebSocketChunkSize]{@link Client#maxWebSocketChunkSize}.\n * Only Java Spring brokers seems to use this mode.\n *\n * WebSockets, by itself, split large (text) packets,\n * so it is not needed with a truly compliant STOMP/WebSocket broker.\n * Actually setting it for such broker will cause large messages to fail.\n *\n * `false` by default.\n *\n * Binary frames are never split.\n */\n public splitLargeFrames: boolean = false;\n\n /**\n * See [splitLargeFrames]{@link Client#splitLargeFrames}.\n * This has no effect if [splitLargeFrames]{@link Client#splitLargeFrames} is `false`.\n */\n public maxWebSocketChunkSize: number = 8 * 1024;\n\n /**\n * Usually the\n * [type of WebSocket frame]{@link https://developer.mozilla.org/en-US/docs/Web/API/WebSocket/send#Parameters}\n * is automatically decided by type of the payload.\n * Default is `false`, which should work with all compliant brokers.\n *\n * Set this flag to force binary frames.\n */\n public forceBinaryWSFrames: boolean = false;\n\n /**\n * A bug in ReactNative chops a string on occurrence of a NULL.\n * See issue [https://github.com/stomp-js/stompjs/issues/89]{@link https://github.com/stomp-js/stompjs/issues/89}.\n * This makes incoming WebSocket messages invalid STOMP packets.\n * Setting this flag attempts to reverse the damage by appending a NULL.\n * If the broker splits a large message into multiple WebSocket messages,\n * this flag will cause data loss and abnormal termination of connection.\n *\n * This is not an ideal solution, but a stop gap until the underlying issue is fixed at ReactNative library.\n */\n public appendMissingNULLonIncoming: boolean = false;\n\n /**\n * Underlying WebSocket instance, READONLY.\n */\n get webSocket(): IStompSocket {\n return this._stompHandler ? this._stompHandler._webSocket : undefined;\n }\n\n /**\n * Connection headers, important keys - `login`, `passcode`, `host`.\n * Though STOMP 1.2 standard marks these keys to be present, check your broker documentation for\n * details specific to your broker.\n */\n public connectHeaders: StompHeaders;\n\n /**\n * Disconnection headers.\n */\n get disconnectHeaders(): StompHeaders {\n return this._disconnectHeaders;\n }\n\n set disconnectHeaders(value: StompHeaders) {\n this._disconnectHeaders = value;\n if (this._stompHandler) {\n this._stompHandler.disconnectHeaders = this._disconnectHeaders;\n }\n }\n private _disconnectHeaders: StompHeaders;\n\n /**\n * This function will be called for any unhandled messages.\n * It is useful for receiving messages sent to RabbitMQ temporary queues.\n *\n * It can also get invoked with stray messages while the server is processing\n * a request to [Client#unsubscribe]{@link Client#unsubscribe}\n * from an endpoint.\n *\n * The actual {@link IMessage} will be passed as parameter to the callback.\n */\n public onUnhandledMessage: messageCallbackType;\n\n /**\n * STOMP brokers can be requested to notify when an operation is actually completed.\n * Prefer using [Client#watchForReceipt]{@link Client#watchForReceipt}. See\n * [Client#watchForReceipt]{@link Client#watchForReceipt} for examples.\n *\n * The actual {@link FrameImpl} will be passed as parameter to the callback.\n */\n public onUnhandledReceipt: frameCallbackType;\n\n /**\n * Will be invoked if {@link FrameImpl} of unknown type is received from the STOMP broker.\n *\n * The actual {@link IFrame} will be passed as parameter to the callback.\n */\n public onUnhandledFrame: frameCallbackType;\n\n /**\n * `true` if there is a active connection with STOMP Broker\n */\n get connected(): boolean {\n return !!this._stompHandler && this._stompHandler.connected;\n }\n\n /**\n * Callback, invoked on before a connection connection to the STOMP broker.\n *\n * You can change options on the client, which will impact the immediate connect.\n * It is valid to call [Client#decativate]{@link Client#deactivate} in this callback.\n *\n * As of version 5.1, this callback can be\n * [async](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/async_function)\n * (i.e., it can return a\n * [Promise](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise)).\n * In that case connect will be called only after the Promise is resolved.\n * This can be used to reliably fetch credentials, access token etc. from some other service\n * in an asynchronous way.\n */\n public beforeConnect: () => void | Promise<void>;\n\n /**\n * Callback, invoked on every successful connection to the STOMP broker.\n *\n * The actual {@link FrameImpl} will be passed as parameter to the callback.\n * Sometimes clients will like to use headers from this frame.\n */\n public onConnect: frameCallbackType;\n\n /**\n * Callback, invoked on every successful disconnection from the STOMP broker. It will not be invoked if\n * the STOMP broker disconnected due to an error.\n *\n * The actual Receipt {@link FrameImpl} acknowledging the DISCONNECT will be passed as parameter to the callback.\n *\n * The way STOMP protocol is designed, the connection may close/terminate without the client\n * receiving the Receipt {@link FrameImpl} acknowledging the DISCONNECT.\n * You might find [Client#onWebSocketClose]{@link Client#onWebSocketClose} more appropriate to watch\n * STOMP broker disconnects.\n */\n public onDisconnect: frameCallbackType;\n\n /**\n * Callback, invoked on an ERROR frame received from the STOMP Broker.\n * A compliant STOMP Broker will close the connection after this type of frame.\n * Please check broker specific documentation for exact behavior.\n *\n * The actual {@link IFrame} will be passed as parameter to the callback.\n */\n public onStompError: frameCallbackType;\n\n /**\n * Callback, invoked when underlying WebSocket is closed.\n *\n * Actual [CloseEvent]{@link https://developer.mozilla.org/en-US/docs/Web/API/CloseEvent}\n * is passed as parameter to the callback.\n */\n public onWebSocketClose: closeEventCallbackType;\n\n /**\n * Callback, invoked when underlying WebSocket raises an error.\n *\n * Actual [Event]{@link https://developer.mozilla.org/en-US/docs/Web/API/Event}\n * is passed as parameter to the callback.\n */\n public onWebSocketError: wsErrorCallbackType;\n\n /**\n * Set it to log the actual raw communication with the broker.\n * When unset, it logs headers of the parsed frames.\n *\n * Change in this effects from next broker reconnect.\n *\n * **Caution: this assumes that frames only have valid UTF8 strings.**\n */\n public logRawCommunication: boolean;\n\n /**\n * By default, debug messages are discarded. To log to `console` following can be used:\n *\n * ```javascript\n * client.debug = function(str) {\n * console.log(str);\n * };\n * ```\n *\n * Currently this method does not support levels of log. Be aware that the output can be quite verbose\n * and may contain sensitive information (like passwords, tokens etc.).\n */\n public debug: debugFnType;\n\n /**\n * Browsers do not immediately close WebSockets when `.close` is issued.\n * This may cause reconnection to take a longer on certain type of failures.\n * In case of incoming heartbeat failure, this experimental flag instructs the library\n * to discard the socket immediately (even before it is actually closed).\n */\n public discardWebsocketOnCommFailure: boolean;\n\n /**\n * version of STOMP protocol negotiated with the server, READONLY\n */\n get connectedVersion(): string {\n return this._stompHandler ? this._stompHandler.connectedVersion : undefined;\n }\n\n private _stompHandler: StompHandler;\n\n /**\n * if the client is active (connected or going to reconnect)\n */\n get active(): boolean {\n return this.state === ActivationState.ACTIVE;\n }\n\n /**\n * It will be called on state change.\n *\n * When deactivating it may go from ACTIVE to INACTIVE without entering DEACTIVATING.\n */\n public onChangeState: (state: ActivationState) => void;\n\n private _changeState(state: ActivationState) {\n this.state = state;\n this.onChangeState(state);\n }\n\n // This will mark deactivate to complete, to be called after Websocket is closed\n private _resolveSocketClose: (value?: PromiseLike<void> | void) => void;\n\n /**\n * Activation state.\n *\n * It will usually be ACTIVE or INACTIVE.\n * When deactivating it may go from ACTIVE to INACTIVE without entering DEACTIVATING.\n */\n public state: ActivationState = ActivationState.INACTIVE;\n\n private _reconnector: any;\n\n /**\n * Create an instance.\n */\n constructor(conf: StompConfig = {}) {\n // Dummy callbacks\n const noOp = () => {};\n this.debug = noOp;\n this.beforeConnect = noOp;\n this.onConnect = noOp;\n this.onDisconnect = noOp;\n this.onUnhandledMessage = noOp;\n this.onUnhandledReceipt = noOp;\n this.onUnhandledFrame = noOp;\n this.onStompError = noOp;\n this.onWebSocketClose = noOp;\n this.onWebSocketError = noOp;\n this.logRawCommunication = false;\n this.onChangeState = noOp;\n\n // These parameters would typically get proper values before connect is called\n this.connectHeaders = {};\n this._disconnectHeaders = {};\n\n // Apply configuration\n this.configure(conf);\n }\n\n /**\n * Update configuration.\n */\n public configure(conf: StompConfig): void {\n // bulk assign all properties to this\n (Object as any).assign(this, conf);\n }\n\n /**\n * Initiate the connection with the broker.\n * If the connection breaks, as per [Client#reconnectDelay]{@link Client#reconnectDelay},\n * it will keep trying to reconnect.\n *\n * Call [Client#deactivate]{@link Client#deactivate} to disconnect and stop reconnection attempts.\n */\n public activate(): void {\n if (this.state === ActivationState.DEACTIVATING) {\n this.debug('Still DEACTIVATING, please await call to deactivate before trying to re-activate');\n throw new Error('Still DEACTIVATING, can not activate now');\n }\n\n if (this.active) {\n this.debug('Already ACTIVE, ignoring request to activate');\n return;\n }\n\n this._changeState(ActivationState.ACTIVE);\n\n this._connect();\n }\n\n private async _connect(): Promise<void> {\n if (this.connected) {\n this.debug('STOMP: already connected, nothing to do');\n return;\n }\n\n await this.beforeConnect();\n\n if (!this.active) {\n this.debug(\n 'Client has been marked inactive, will not attempt to connect'\n );\n return;\n }\n\n // setup connection watcher\n if (this.connectionTimeout > 0) {\n this._connectionWatcher = setTimeout(() => {\n // Connection not established, close the underlying socket\n // a reconnection will be attempted\n this.debug(\n `Connection not established in ${this.connectionTimeout}ms, closing socket`\n );\n this.forceDisconnect();\n }, this.connectionTimeout);\n }\n\n this.debug('Opening Web Socket...');\n\n // Get the actual WebSocket (or a similar object)\n const webSocket = this._createWebSocket();\n\n this._stompHandler = new StompHandler(this, webSocket, {\n debug: this.debug,\n stompVersions: this.stompVersions,\n connectHeaders: this.connectHeaders,\n disconnectHeaders: this._disconnectHeaders,\n heartbeatIncoming: this.heartbeatIncoming,\n heartbeatOutgoing: this.heartbeatOutgoing,\n splitLargeFrames: this.splitLargeFrames,\n maxWebSocketChunkSize: this.maxWebSocketChunkSize,\n forceBinaryWSFrames: this.forceBinaryWSFrames,\n logRawCommunication: this.logRawCommunication,\n appendMissingNULLonIncoming: this.appendMissingNULLonIncoming,\n discardWebsocketOnCommFailure: this.discardWebsocketOnCommFailure,\n\n onConnect: frame => {\n // Successfully connected, stop the connection watcher\n if (this._connectionWatcher) {\n clearTimeout(this._connectionWatcher);\n this._connectionWatcher = undefined;\n }\n\n if (!this.active) {\n this.debug(\n 'STOMP got connected while deactivate was issued, will disconnect now'\n );\n this._disposeStompHandler();\n return;\n }\n this.onConnect(frame);\n },\n onDisconnect: frame => {\n this.onDisconnect(frame);\n },\n onStompError: frame => {\n this.onStompError(frame);\n },\n onWebSocketClose: evt => {\n this._stompHandler = undefined; // a new one will be created in case of a reconnect\n\n if (this.state === ActivationState.DEACTIVATING) {\n // Mark deactivation complete\n this._resolveSocketClose();\n this._resolveSocketClose = undefined;\n this._changeState(ActivationState.INACTIVE);\n }\n\n this.onWebSocketClose(evt);\n // The callback is called before attempting to reconnect, this would allow the client\n // to be `deactivated` in the callback.\n if (this.active) {\n this._schedule_reconnect();\n }\n },\n onWebSocketError: evt => {\n this.onWebSocketError(evt);\n },\n onUnhandledMessage: message => {\n this.onUnhandledMessage(message);\n },\n onUnhandledReceipt: frame => {\n this.onUnhandledReceipt(frame);\n },\n onUnhandledFrame: frame => {\n this.onUnhandledFrame(frame);\n },\n });\n\n this._stompHandler.start();\n }\n\n private _createWebSocket(): IStompSocket {\n let webSocket: IStompSocket;\n\n if (this.webSocketFactory) {\n webSocket = this.webSocketFactory();\n } else {\n webSocket = new WebSocket(\n this.brokerURL,\n this.stompVersions.protocolVersions()\n );\n }\n webSocket.binaryType = 'arraybuffer';\n return webSocket;\n }\n\n private _schedule_reconnect(): void {\n if (this.reconnectDelay > 0) {\n this.debug(`STOMP: scheduling reconnection in ${this.reconnectDelay}ms`);\n\n this._reconnector = setTimeout(() => {\n this._connect();\n }, this.reconnectDelay);\n }\n }\n\n /**\n * Disconnect if connected and stop auto reconnect loop.\n * Appropriate callbacks will be invoked if underlying STOMP connection was connected.\n *\n * This call is async, it will resolve immediately if there is no underlying active websocket,\n * otherwise, it will resolve after underlying websocket is properly disposed.\n *\n * To reactivate you can call [Client#activate]{@link Client#activate}.\n */\n public async deactivate(): Promise<void> {\n let retPromise: Promise<void>;\n\n if (this.state !== ActivationState.ACTIVE) {\n this.debug(\n `Already ${ActivationState[this.state]}, ignoring call to deactivate`\n );\n return Promise.resolve();\n }\n\n this._changeState(ActivationState.DEACTIVATING);\n\n // Clear if a reconnection was scheduled\n if (this._reconnector) {\n clearTimeout(this._reconnector);\n }\n\n if (\n this._stompHandler &&\n this.webSocket.readyState !== StompSocketState.CLOSED\n ) {\n // we need to wait for underlying websocket to close\n retPromise = new Promise<void>((resolve, reject) => {\n this._resolveSocketClose = resolve;\n });\n } else {\n // indicate that auto reconnect loop should terminate\n this._changeState(ActivationState.INACTIVE);\n return Promise.resolve();\n }\n\n this._disposeStompHandler();\n\n return retPromise;\n }\n\n /**\n * Force disconnect if there is an active connection by directly closing the underlying WebSocket.\n * This is different than a normal disconnect where a DISCONNECT sequence is carried out with the broker.\n * After forcing disconnect, automatic reconnect will be attempted.\n * To stop further reconnects call [Client#deactivate]{@link Client#deactivate} as well.\n */\n public forceDisconnect() {\n if (this._stompHandler) {\n this._stompHandler.forceDisconnect();\n }\n }\n\n private _disposeStompHandler() {\n // Dispose STOMP Handler\n if (this._stompHandler) {\n this._stompHandler.dispose();\n this._stompHandler = null;\n }\n }\n\n /**\n * Send a message to a named destination. Refer to your STOMP broker documentation for types\n * and naming of destinations.\n *\n * STOMP protocol specifies and suggests some headers and also allows broker specific headers.\n *\n * `body` must be String.\n * You will need to covert the payload to string in case it is not string (e.g. JSON).\n *\n * To send a binary message body use binaryBody parameter. It should be a\n * [Uint8Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Uint8Array).\n * Sometimes brokers may not support binary frames out of the box.\n * Please check your broker documentation.\n *\n * `content-length` header is automatically added to the STOMP Frame sent to the broker.\n * Set `skipContentLengthHeader` to indicate that `content-length` header should not be added.\n * For binary messages `content-length` header is always added.\n *\n * Caution: The broker will, most likely, report an error and disconnect if message body has NULL octet(s)\n * and `content-length` header is missing.\n *\n * ```javascript\n * client.publish({destination: \"/queue/test\", headers: {priority: 9}, body: \"Hello, STOMP\"});\n *\n * // Only destination is mandatory parameter\n * client.publish({destination: \"/queue/test\", body: \"Hello, STOMP\"});\n *\n * // Skip content-length header in the frame to the broker\n * client.publish({\"/queue/test\", body: \"Hello, STOMP\", skipContentLengthHeader: true});\n *\n * var binaryData = generateBinaryData(); // This need to be of type Uint8Array\n * // setting content-type header is not mandatory, however a good practice\n * client.publish({destination: '/topic/special', binaryBody: binaryData,\n * headers: {'content-type': 'application/octet-stream'}});\n * ```\n */\n public publish(params: IPublishParams) {\n this._stompHandler.publish(params);\n }\n\n /**\n * STOMP brokers may carry out operation asynchronously and allow requesting for acknowledgement.\n * To request an acknowledgement, a `receipt` header needs to be sent with the actual request.\n * The value (say receipt-id) for this header needs to be unique for each use. Typically a sequence, a UUID, a\n * random number or a combination may be used.\n *\n * A complaint broker will send a RECEIPT frame when an operation has actually been completed.\n * The operation needs to be matched based in the value of the receipt-id.\n *\n * This method allow watching for a receipt and invoke the callback\n * when corresponding receipt has been received.\n *\n * The actual {@link FrameImpl} will be passed as parameter to the callback.\n *\n * Example:\n * ```javascript\n * // Subscribing with acknowledgement\n * let receiptId = randomText();\n *\n * client.watchForReceipt(receiptId, function() {\n * // Will be called after server acknowledges\n * });\n *\n * client.subscribe(TEST.destination, onMessage, {receipt: receiptId});\n *\n *\n * // Publishing with acknowledgement\n * receiptId = randomText();\n *\n * client.watchForReceipt(receiptId, function() {\n * // Will be called after server acknowledges\n * });\n * client.publish({destination: TEST.destination, headers: {receipt: receiptId}, body: msg});\n * ```\n */\n public watchForReceipt(receiptId: string, callback: frameCallbackType): void {\n this._stompHandler.watchForReceipt(receiptId, callback);\n }\n\n /**\n * Subscribe to a STOMP Broker location. The callback will be invoked for each received message with\n * the {@link IMessage} as argument.\n *\n * Note: The library will generate an unique ID if there is none provided in the headers.\n * To use your own ID, pass it using the headers argument.\n *\n * ```javascript\n * callback = function(message) {\n * // called when the client receives a STOMP message from the server\n * if (message.body) {\n * alert(\"got message with body \" + message.body)\n * } else {\n * alert(\"got empty message\");\n * }\n * });\n *\n * var subscription = client.subscribe(\"/queue/test\", callback);\n *\n * // Explicit subscription id\n * var mySubId = 'my-subscription-id-001';\n * var subscription = client.subscribe(destination, callback, { id: mySubId });\n * ```\n */\n public subscribe(\n destination: string,\n callback: messageCallbackType,\n headers: StompHeaders = {}\n ): StompSubscription {\n return this._stompHandler.subscribe(destination, callback, headers);\n }\n\n /**\n * It is preferable to unsubscribe from a subscription by calling\n * `unsubscribe()` directly on {@link StompSubscription} returned by `client.subscribe()`:\n *\n * ```javascript\n * var subscription = client.subscribe(destination, onmessage);\n * // ...\n * subscription.unsubscribe();\n * ```\n *\n * See: http://stomp.github.com/stomp-specification-1.2.html#UNSUBSCRIBE UNSUBSCRIBE Frame\n */\n public unsubscribe(id: string, headers: StompHeaders = {}): void {\n this._stompHandler.unsubscribe(id, headers);\n }\n\n /**\n * Start a transaction, the returned {@link ITransaction} has methods - [commit]{@link ITransaction#commit}\n * and [abort]{@link ITransaction#abort}.\n *\n * `transactionId` is optional, if not passed the library will generate it internally.\n */\n public begin(transactionId?: string): ITransaction {\n return this._stompHandler.begin(transactionId);\n }\n\n /**\n * Commit a transaction.\n *\n * It is preferable to commit a transaction by calling [commit]{@link ITransaction#commit} directly on\n * {@link ITransaction} returned by [client.begin]{@link Client#begin}.\n *\n * ```javascript\n * var tx = client.begin(txId);\n * //...\n * tx.commit();\n * ```\n */\n public commit(transactionId: string): void {\n this._stompHandler.commit(transactionId);\n }\n\n /**\n * Abort a transaction.\n * It is preferable to abort a transaction by calling [abort]{@link ITransaction#abort} directly on\n * {@link ITransaction} returned by [client.begin]{@link Client#begin}.\n *\n * ```javascript\n * var tx = client.begin(txId);\n * //...\n * tx.abort();\n * ```\n */\n public abort(transactionId: string): void {\n this._stompHandler.abort(transactionId);\n }\n\n /**\n * ACK a message. It is preferable to acknowledge a message by calling [ack]{@link IMessage#ack} directly\n * on the {@link IMessage} handled by a subscription callback:\n *\n * ```javascript\n * var callback = function (message) {\n * // process the message\n * // acknowledge it\n * message.ack();\n * };\n * client.subscribe(destination, callback, {'ack': 'client'});\n * ```\n */\n public ack(\n messageId: string,\n subscriptionId: string,\n headers: StompHeaders = {}\n ): void {\n this._stompHandler.ack(messageId, subscriptionId, headers);\n }\n\n /**\n * NACK a message. It is preferable to acknowledge a message by calling [nack]{@link IMessage#nack} directly\n * on the {@link IMessage} handled by a subscription callback:\n *\n * ```javascript\n * var callback = function (message) {\n * // process the message\n * // an error occurs, nack it\n * message.nack();\n * };\n * client.subscribe(destination, callback, {'ack': 'client'});\n * ```\n */\n public nack(\n messageId: string,\n subscriptionId: string,\n headers: StompHeaders = {}\n ): void {\n this._stompHandler.nack(messageId, subscriptionId, headers);\n }\n}\n","import { StompHeaders } from './stomp-headers';\nimport {\n ActivationState,\n closeEventCallbackType,\n debugFnType,\n frameCallbackType,\n messageCallbackType,\n wsErrorCallbackType,\n} from './types';\nimport { Versions } from './versions';\n\n/**\n * Configuration options for STOMP Client, each key corresponds to\n * field by the same name in {@link Client}. This can be passed to\n * the constructor of {@link Client} or to [Client#configure]{@link Client#configure}.\n *\n * There used to be a class with the same name in `@stomp/ng2-stompjs`, which has been replaced by\n * {@link RxStompConfig} and {@link InjectableRxStompConfig}.\n *\n * Part of `@stomp/stompjs`.\n */\nexport class StompConfig {\n /**\n * See [Client#brokerURL]{@link Client#brokerURL}.\n */\n public brokerURL?: string;\n\n /**\n * See See [Client#stompVersions]{@link Client#stompVersions}.\n */\n public stompVersions?: Versions;\n\n /**\n * See [Client#webSocketFactory]{@link Client#webSocketFactory}.\n */\n public webSocketFactory?: () => any;\n\n /**\n * See [Client#connectionTimeout]{@link Client#connectionTimeout}.\n */\n public connectionTimeout?: number;\n\n /**\n * See [Client#reconnectDelay]{@link Client#reconnectDelay}.\n */\n public reconnectDelay?: number;\n\n /**\n * See [Client#heartbeatIncoming]{@link Client#heartbeatIncoming}.\n */\n public heartbeatIncoming?: number;\n\n /**\n * See [Client#heartbeatOutgoing]{@link Client#heartbeatOutgoing}.\n */\n public heartbeatOutgoing?: number;\n\n /**\n * See [Client#splitLargeFrames]{@link Client#splitLargeFrames}.\n */\n public splitLargeFrames?: boolean;\n\n /**\n * See [Client#forceBinaryWSFrames]{@link Client#forceBinaryWSFrames}.\n */\n public forceBinaryWSFrames?: boolean;\n\n /**\n * See [Client#appendMissingNULLonIncoming]{@link Client#appendMissingNULLonIncoming}.\n */\n public appendMissingNULLonIncoming?: boolean;\n\n /**\n * See [Client#maxWebSocketChunkSize]{@link Client#maxWebSocketChunkSize}.\n */\n public maxWebSocketChunkSize?: number;\n\n /**\n * See [Client#connectHeaders]{@link Client#connectHeaders}.\n */\n public connectHeaders?: StompHeaders;\n\n /**\n * See [Client#disconnectHeaders]{@link Client#disconnectHeaders}.\n */\n public disconnectHeaders?: StompHeaders;\n\n /**\n * See [Client#onUnhandledMessage]{@link Client#onUnhandledMessage}.\n */\n public onUnhandledMessage?: messageCallbackType;\n\n /**\n * See [Client#onUnhandledReceipt]{@link Client#onUnhandledReceipt}.\n */\n public onUnhandledReceipt?: frameCallbackType;\n\n /**\n * See [Client#onUnhandledFrame]{@link Client#onUnhandledFrame}.\n */\n public onUnhandledFrame?: frameCallbackType;\n\n /**\n * See [Client#beforeConnect]{@link Client#beforeConnect}.\n */\n public beforeConnect?: () => void | Promise<void>;\n\n /**\n * See [Client#onConnect]{@link Client#onConnect}.\n */\n public onConnect?: frameCallbackType;\n\n /**\n * See [Client#onDisconnect]{@link Client#onDisconnect}.\n */\n public onDisconnect?: frameCallbackType;\n\n /**\n * See [Client#onStompError]{@link Client#onStompError}.\n */\n public onStompError?: frameCallbackType;\n\n /**\n * See [Client#onWebSocketClose]{@link Client#onWebSocketClose}.\n */\n public onWebSocketClose?: closeEventCallbackType;\n\n /**\n * See [Client#onWebSocketError]{@link Client#onWebSocketError}.\n */\n public onWebSocketError?: wsErrorCallbackType;\n\n /**\n * See [Client#logRawCommunication]{@link Client#logRawCommunication}.\n */\n public logRawCommunication?: boolean;\n\n /**\n * See [Client#debug]{@link Client#debug}.\n */\n public debug?: debugFnType;\n\n /**\n * See [Client#discardWebsocketOnCommFailure]{@link Client#discardWebsocketOnCommFailure}.\n */\n public discardWebsocketOnCommFailure?: boolean;\n\n /**\n * See [Client#onChangeState]{@link Client#onChangeState}.\n */\n public onChangeState?: (state: ActivationState) => void;\n}\n","/**\n * STOMP headers. Many functions calls will accept headers as parameters.\n * The headers sent by Broker will be available as [IFrame#headers]{@link IFrame#headers}.\n *\n * `key` and `value` must be valid strings.\n * In addition, `key` must not contain `CR`, `LF`, or `:`.\n *\n * Part of `@stomp/stompjs`.\n */\nexport class StompHeaders {\n [key: string]: string;\n}\n","import { StompHeaders } from './stomp-headers';\n\n/**\n * Call [Client#subscribe]{@link Client#subscribe} to create a StompSubscription.\n *\n * Part of `@stomp/stompjs`.\n */\nexport class StompSubscription {\n /**\n * Id associated with this subscription.\n */\n public id: string;\n\n /**\n * Unsubscribe. See [Client#unsubscribe]{@link Client#unsubscribe} for an example.\n */\n public unsubscribe: (headers?: StompHeaders) => void;\n}\n","import { CompatClient } from './compat-client';\n\n/**\n * Part of `@stomp/stompjs`.\n *\n * @internal\n */\nexport class HeartbeatInfo {\n constructor(private client: CompatClient) {}\n\n get outgoing(): number {\n return this.client.heartbeatOutgoing;\n }\n\n set outgoing(value: number) {\n this.client.heartbeatOutgoing = value;\n }\n\n get incoming(): number {\n return this.client.heartbeatIncoming;\n }\n\n set incoming(value: number) {\n this.client.heartbeatIncoming = value;\n }\n}\n","import { Client } from '../client';\nimport { StompHeaders } from '../stomp-headers';\nimport { frameCallbackType, messageCallbackType } from '../types';\nimport { HeartbeatInfo } from './heartbeat-info';\n\n/**\n * Available for backward compatibility, please shift to using {@link Client}.\n *\n * **Deprecated**\n *\n * Part of `@stomp/stompjs`.\n *\n * To upgrade, please follow the [Upgrade Guide](../additional-documentation/upgrading.html)\n */\nexport class CompatClient extends Client {\n /**\n * It is no op now. No longer needed. Large packets work out of the box.\n */\n public maxWebSocketFrameSize: number = 16 * 1024;\n\n /**\n * Available for backward compatibility, please shift to using {@link Client}\n * and [Client#webSocketFactory]{@link Client#webSocketFactory}.\n *\n * **Deprecated**\n *\n * @internal\n */\n constructor(webSocketFactory: () => any) {\n super();\n this.reconnect_delay = 0;\n this.webSocketFactory = webSocketFactory;\n // Default from previous version\n this.debug = (...message: any[]) => {\n console.log(...message);\n };\n }\n\n private _parseConnect(...args: any[]): any {\n let closeEventCallback;\n let connectCallback;\n let errorCallback;\n let headers: StompHeaders = {};\n if (args.length < 2) {\n throw new Error('Connect requires at least 2 arguments');\n }\n if (typeof args[1] === 'function') {\n [headers, connectCallback, errorCallback, closeEventCallback] = args;\n } else {\n switch (args.length) {\n case 6:\n [\n headers.login,\n headers.passcode,\n connectCallback,\n errorCallback,\n closeEventCallback,\n headers.host,\n ] = args;\n break;\n default:\n [\n headers.login,\n headers.passcode,\n connectCallback,\n errorCallback,\n closeEventCallback,\n ] = args;\n }\n }\n\n return [headers, connectCallback, errorCallback, closeEventCallback];\n }\n\n /**\n * Available for backward compatibility, please shift to using [Client#activate]{@link Client#activate}.\n *\n * **Deprecated**\n *\n * The `connect` method accepts different number of arguments and types. See the Overloads list. Use the\n * version with headers to pass your broker specific options.\n *\n * overloads:\n * - connect(headers, connectCallback)\n * - connect(headers, connectCallback, errorCallback)\n * - connect(login, passcode, connectCallback)\n * - connect(login, passcode, connectCallback, errorCallback)\n * - connect(login, passcode, connectCallback, errorCallback, closeEventCallback)\n * - connect(login, passcode, connectCallback, errorCallback, closeEventCallback, host)\n *\n * params:\n * - headers, see [Client#connectHeaders]{@link Client#connectHeaders}\n * - connectCallback, see [Client#onConnect]{@link Client#onConnect}\n * - errorCallback, see [Client#onStompError]{@link Client#onStompError}\n * - closeEventCallback, see [Client#onWebSocketClose]{@link Client#onWebSocketClose}\n * - login [String], see [Client#connectHeaders](../classes/Client.html#connectHeaders)\n * - passcode [String], [Client#connectHeaders](../classes/Client.html#connectHeaders)\n * - host [String], see [Client#connectHeaders](../classes/Client.html#connectHeaders)\n *\n * To upgrade, please follow the [Upgrade Guide](../additional-documentation/upgrading.html)\n */\n public connect(...args: any[]): void {\n const out = this._parseConnect(...args);\n\n if (out[0]) {\n this.connectHeaders = out[0];\n }\n if (out[1]) {\n this.onConnect = out[1];\n }\n if (out[2]) {\n this.onStompError = out[2];\n }\n if (out[3]) {\n this.onWebSocketClose = out[3];\n }\n\n super.activate();\n }\n\n /**\n * Available for backward compatibility, please shift to using [Client#deactivate]{@link Client#deactivate}.\n *\n * **Deprecated**\n *\n * See:\n * [Client#onDisconnect]{@link Client#onDisconnect}, and\n * [Client#disconnectHeaders]{@link Client#disconnectHeaders}\n *\n * To upgrade, please follow the [Upgrade Guide](../additional-documentation/upgrading.html)\n */\n public disconnect(\n disconnectCallback?: any,\n headers: StompHeaders = {}\n ): void {\n if (disconnectCallback) {\n this.onDisconnect = disconnectCallback;\n }\n this.disconnectHeaders = headers;\n\n super.deactivate();\n }\n\n /**\n * Available for backward compatibility, use [Client#publish]{@link Client#publish}.\n *\n * Send a message to a named destination. Refer to your STOMP broker documentation for types\n * and naming of destinations. The headers will, typically, be available to the subscriber.\n * However, there may be special purpose headers corresponding to your STOMP broker.\n *\n * **Deprecated**, use [Client#publish]{@link Client#publish}\n *\n * Note: Body must be String. You will need to covert the payload to string in case it is not string (e.g. JSON)\n *\n * ```javascript\n * client.send(\"/queue/test\", {priority: 9}, \"Hello, STOMP\");\n *\n * // If you want to send a message with a body, you must also pass the headers argument.\n * client.send(\"/queue/test\", {}, \"Hello, STOMP\");\n * ```\n *\n * To upgrade, please follow the [Upgrade Guide](../additional-documentation/upgrading.html)\n */\n public send(\n destination: string,\n headers: { [key: string]: any } = {},\n body: string = ''\n ): void {\n headers = (Object as any).assign({}, headers);\n\n const skipContentLengthHeader = headers['content-length'] === false;\n if (skipContentLengthHeader) {\n delete headers['content-length'];\n }\n this.publish({\n destination,\n headers: headers as StompHeaders,\n body,\n skipContentLengthHeader,\n });\n }\n\n /**\n * Available for backward compatibility, renamed to [Client#reconnectDelay]{@link Client#reconnectDelay}.\n *\n * **Deprecated**\n */\n set reconnect_delay(value: number) {\n this.reconnectDelay = value;\n }\n\n /**\n * Available for backward compatibility, renamed to [Client#webSocket]{@link Client#webSocket}.\n *\n * **Deprecated**\n */\n get ws(): any {\n return this.webSocket;\n }\n\n /**\n * Available for backward compatibility, renamed to [Client#connectedVersion]{@link Client#connectedVersion}.\n *\n * **Deprecated**\n */\n get version() {\n return this.connectedVersion;\n }\n\n /**\n * Available for backward compatibility, renamed to [Client#onUnhandledMessage]{@link Client#onUnhandledMessage}.\n *\n * **Deprecated**\n */\n get onreceive(): messageCallbackType {\n return this.onUnhandledMessage;\n }\n\n /**\n * Available for backward compatibility, renamed to [Client#onUnhandledMessage]{@link Client#onUnhandledMessage}.\n *\n * **Deprecated**\n */\n set onreceive(value: messageCallbackType) {\n this.onUnhandledMessage = value;\n }\n\n /**\n * Available for backward compatibility, renamed to [Client#onUnhandledReceipt]{@link Client#onUnhandledReceipt}.\n * Prefer using [Client#watchForReceipt]{@link Client#watchForReceipt}.\n *\n * **Deprecated**\n */\n get onreceipt(): frameCallbackType {\n return this.onUnhandledReceipt;\n }\n\n /**\n * Available for backward compatibility, renamed to [Client#onUnhandledReceipt]{@link Client#onUnhandledReceipt}.\n *\n * **Deprecated**\n */\n set onreceipt(value: frameCallbackType) {\n this.onUnhandledReceipt = value;\n }\n\n private _heartbeatInfo: HeartbeatInfo = new HeartbeatInfo(this);\n\n /**\n * Available for backward compatibility, renamed to [Client#heartbeatIncoming]{@link Client#heartbeatIncoming}\n * [Client#heartbeatOutgoing]{@link Client#heartbeatOutgoing}.\n *\n * **Deprecated**\n */\n get heartbeat() {\n return this._heartbeatInfo;\n }\n\n /**\n * Available for backward compatibility, renamed to [Client#heartbeatIncoming]{@link Client#heartbeatIncoming}\n * [Client#heartbeatOutgoing]{@link Client#heartbeatOutgoing}.\n *\n * **Deprecated**\n */\n set heartbeat(value: { incoming: number; outgoing: number }) {\n this.heartbeatIncoming = value.incoming;\n this.heartbeatOutgoing = value.outgoing;\n }\n}\n","import { Versions } from '../versions';\nimport { CompatClient } from './compat-client';\nimport { IStompSocket } from '../types';\n\n/**\n * @internal\n */\ndeclare const WebSocket: {\n prototype: IStompSocket;\n new (url: string, protocols?: string | string[]): IStompSocket;\n};\n\n/**\n * STOMP Class, acts like a factory to create {@link Client}.\n *\n * Part of `@stomp/stompjs`.\n *\n * **Deprecated**\n *\n * It will be removed in next major version. Please switch to {@link Client}.\n */\nexport class Stomp {\n /**\n * In case you need to use a non standard class for WebSocket.\n *\n * For example when using within NodeJS environment:\n *\n * ```javascript\n * StompJs = require('../../esm5/');\n * Stomp = StompJs.Stomp;\n * Stomp.WebSocketClass = require('websocket').w3cwebsocket;\n * ```\n *\n * **Deprecated**\n *\n *\n * It will be removed in next major version. Please switch to {@link Client}\n * using [Client#webSocketFactory]{@link Client#webSocketFactory}.\n */\n // tslint:disable-next-line:variable-name\n public static WebSocketClass: any = null;\n\n /**\n * This method creates a WebSocket client that is connected to\n * the STOMP server located at the url.\n *\n * ```javascript\n * var url = \"ws://localhost:61614/stomp\";\n * var client = Stomp.client(url);\n * ```\n *\n * **Deprecated**\n *\n * It will be removed in next major version. Please switch to {@link Client}\n * using [Client#brokerURL]{@link Client#brokerURL}.\n */\n public static client(url: string, protocols?: string[]): CompatClient {\n // This is a hack to allow another implementation than the standard\n // HTML5 WebSocket class.\n //\n // It is possible to use another class by calling\n //\n // Stomp.WebSocketClass = MozWebSocket\n //\n // *prior* to call `Stomp.client()`.\n //\n // This hack is deprecated and `Stomp.over()` method should be used\n // instead.\n\n // See remarks on the function Stomp.over\n if (protocols == null) {\n protocols = Versions.default.protocolVersions();\n }\n const wsFn = () => {\n const klass = Stomp.WebSocketClass || WebSocket;\n return new klass(url, protocols);\n };\n\n return new CompatClient(wsFn);\n }\n\n /**\n * This method is an alternative to [Stomp#client]{@link Stomp#client} to let the user\n * specify the WebSocket to use (either a standard HTML5 WebSocket or\n * a similar object).\n *\n * In order to support reconnection, the function Client._connect should be callable more than once.\n * While reconnecting\n * a new instance of underlying transport (TCP Socket, WebSocket or SockJS) will be needed. So, this function\n * alternatively allows passing a function that should return a new instance of the underlying socket.\n *\n * ```javascript\n * var client = Stomp.over(function(){\n * return new WebSocket('ws://localhost:15674/ws')\n * });\n * ```\n *\n * **Deprecated**\n *\n * It will be removed in next major version. Please switch to {@link Client}\n * using [Client#webSocketFactory]{@link Client#webSocketFactory}.\n */\n public static over(ws: any): CompatClient {\n let wsFn: () => any;\n\n if (typeof ws === 'function') {\n wsFn = ws;\n } else {\n console.warn(\n 'Stomp.over did not receive a factory, auto reconnect will not work. ' +\n 'Please see https://stomp-js.github.io/api-docs/latest/classes/Stomp.html#over'\n );\n wsFn = () => ws;\n }\n\n return new CompatClient(wsFn);\n }\n}\n"],"sourceRoot":""}
package/esm6/client.d.ts CHANGED
@@ -55,7 +55,7 @@ export declare class Client {
55
55
  webSocketFactory: () => IStompSocket;
56
56
  /**
57
57
  * Will retry if Stomp connection is not established in specified milliseconds.
58
- * Default 10,000ms, set to 0 to wait for ever.
58
+ * Default 0, which implies wait for ever.
59
59
  */
60
60
  connectionTimeout: number;
61
61
  private _connectionWatcher;
package/esm6/client.js CHANGED
@@ -32,9 +32,9 @@ export class Client {
32
32
  this.stompVersions = Versions.default;
33
33
  /**
34
34
  * Will retry if Stomp connection is not established in specified milliseconds.
35
- * Default 10,000ms, set to 0 to wait for ever.
35
+ * Default 0, which implies wait for ever.
36
36
  */
37
- this.connectionTimeout = 10000;
37
+ this.connectionTimeout = 0;
38
38
  /**
39
39
  * automatically reconnect with delay in milliseconds, set to 0 to disable.
40
40
  */
@@ -1 +1 @@
1
- {"version":3,"file":"client.js","sourceRoot":"","sources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