Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

FlashSocket transport is properly working now.

  • Loading branch information...
commit 8d86d5e0e3351a2725062063f5c4265358774e3e 1 parent 0612c57
@mrjoes authored
View
BIN  examples/WebSocketMain.swf
Binary file not shown
View
1  examples/crosssite/index.html
@@ -3,7 +3,6 @@
<head>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>
<script src="socket.io.js"></script>
- <script>WEB_SOCKET_SWF_LOCATION = 'http://cdn.socket.io/stable/WebSocketMain.swf';</script>
<script>
$(function() {
var s = new io.connect('http://localhost:8002', {
View
1  examples/gen/index.html
@@ -3,7 +3,6 @@
<head>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>
<script src="socket.io.js"></script>
- <script>WEB_SOCKET_SWF_LOCATION = 'http://cdn.socket.io/stable/WebSocketMain.swf';</script>
<script>
$(function() {
var query = new io.connect('http://localhost:8001');
View
1  examples/multiplexed/index.html
@@ -3,7 +3,6 @@
<head>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>
<script src="socket.io.js"></script>
- <script>WEB_SOCKET_SWF_LOCATION = 'http://cdn.socket.io/stable/WebSocketMain.swf';</script>
<script>
$(function() {
var sock = new io.connect('http://localhost:8001'),
View
1  examples/rpcping/index.html
@@ -3,7 +3,6 @@
<head>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>
<script src="socket.io.js"></script>
- <script>WEB_SOCKET_SWF_LOCATION = 'http://cdn.socket.io/stable/WebSocketMain.swf';</script>
<script>
$(function() {
var ping = new io.connect('http://localhost:8001');
View
4 examples/transports/index.html
@@ -3,7 +3,9 @@
<head>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>
<script src="socket.io.js"></script>
- <script>WEB_SOCKET_SWF_LOCATION = 'http://cdn.socket.io/stable/WebSocketMain.swf';</script>
+ <script>
+ WEB_SOCKET_SWF_LOCATION = 'WebSocketMain.swf';
+ </script>
<script>
var conn = null;
$(function() {
View
15 examples/transports/transports.py
@@ -20,6 +20,17 @@ def get(self):
self.render('../socket.io.js')
+class WebSocketFileHandler(tornado.web.RequestHandler):
+ def get(self):
+ # Obviously, you want this on CDN, but for sake of
+ # example this approach will work.
+ self.set_header('Content-Type', 'application/x-shockwave-flash')
+
+ with open(op.join(ROOT, '../WebSocketMain.swf'), 'rb') as f:
+ self.write(f.read())
+ self.finish()
+
+
class ChatConnection(tornadio2.conn.SocketConnection):
# Class level variable
participants = set()
@@ -42,7 +53,9 @@ def on_close(self):
# Create application
application = tornado.web.Application(
ChatRouter.apply_routes([(r"/", IndexHandler),
- (r"/socket.io.js", SocketIOHandler)]),
+ (r"/socket.io.js", SocketIOHandler),
+ (r"/WebSocketMain.swf", WebSocketFileHandler)
+ ]),
flash_policy_port = 843,
flash_policy_file = op.join(ROOT, 'flashpolicy.xml'),
socket_io_port = 8001
View
2  tornadio2/persistent.py
@@ -80,6 +80,6 @@ def session_closed(self):
self._detach()
-class TornadioFlashSocketHandler(WebSocketHandler):
+class TornadioFlashSocketHandler(TornadioWebSocketHandler):
# Transport name
name = 'flashsocket'
View
8 tornadio2/proto.py
@@ -47,7 +47,7 @@ def default(self, o):
ERROR = '7'
NOOP = '8'
-# utf-8 encoded frame separator
+# socket.io frame separator
FRAME_SEPARATOR = u'\ufffd'
@@ -186,7 +186,7 @@ def json_dumps(msg):
def json_load(msg):
- """Load json
+ """Load json-encoded object
`msg`
json encoded object
@@ -211,9 +211,7 @@ def decode_frames(data):
idx = 0
packets = []
- frame_len = len(FRAME_SEPARATOR)
-
- while data[idx:idx + frame_len] == FRAME_SEPARATOR:
+ while data[idx:idx + 1] == FRAME_SEPARATOR:
idx += 1
# Grab message length
Please sign in to comment.
Something went wrong with that request. Please try again.