Created
July 25, 2013 14:43
-
-
Save chirino/6080386 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/src/stomp.coffee b/src/stomp.coffee | |
index 7408f23..983001f 100644 | |
--- a/src/stomp.coffee | |
+++ b/src/stomp.coffee | |
@@ -19,6 +19,8 @@ Byte = | |
# NULL byte (octet 0) | |
NULL: '\x00' | |
+MAX_FRAME_SIZE = 16*1024 | |
+ | |
# ##[STOMP Frame](http://stomp.github.com/stomp-specification-1.1.html#STOMP_Frames) Class | |
class Frame | |
# Frame constructor | |
@@ -117,7 +119,12 @@ class Client | |
_transmit: (command, headers, body) -> | |
out = Frame.marshall(command, headers, body) | |
@debug? ">>> " + out | |
- @ws.send(out) | |
+ while(true) | |
+ if out.length > MAX_FRAME_SIZE | |
+ @ws.send(out.substring(0, MAX_FRAME_SIZE)) | |
+ out = out.substring(MAX_FRAME_SIZE) | |
+ else | |
+ return @ws.send(out) | |
_setupHeartbeat: (headers) -> | |
return unless headers.version in [Stomp.VERSIONS.V1_1, Stomp.VERSIONS.V1_2] | |
@@ -355,4 +362,4 @@ else if exports? | |
Stomp.WebSocketClass = require('./test/server.mock.js').StompServerMock | |
# or in the current object (e.g. a WebWorker) | |
else | |
- self.Stomp = Stomp | |
\ No newline at end of file | |
+ self.Stomp = Stomp |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment