notes 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. Some implementation notes:
  2. There is an included flash object (web-socket-js) that is used to
  3. emulate websocket support on browsers without websocket support
  4. (currently only Chrome has WebSocket support).
  5. The performance on Chrome is great. It only takes about 150ms on my
  6. system to render a complete 800x600 hextile frame. Most updates are
  7. partial or use copyrect which is much faster.
  8. When using the flash websocket emulator, packets event aren't always
  9. delivered in order. This may be a bug in the way I'm using the
  10. FABridge interface. Or a bug in FABridge itself, or just a browser
  11. event delivery issue. Anyways, to get around this problem, when the
  12. flash emulator is being used, the client issues the WebSocket GET
  13. request with the "seq_num" variable. This switches on in-band sequence
  14. numbering of the packets in the proxy, and the client has a queue of
  15. out-of-order packets (20 deep currently) that it uses to re-order.
  16. Gross!
  17. The performance on firefox 3.5 is usable. It takes 2.3 seconds to
  18. render a 800x600 hextile frame on my system (the initial connect).
  19. Once the initial first update is done though, it's quite usable (as
  20. above, most updates are partial or copyrect). I haven't tested firefox
  21. 3.7 yet, it might be a lot faster.
  22. Opera sucks big time. The flash websocket emulator fails to deliver as
  23. many as 40% of packet events when used on Opera. It may or not be
  24. Opera's fault, but something goes badly wrong at the FABridge
  25. boundary.
  26. Javascript doesn't have a bytearray type, so what you get out of
  27. a WebSocket object is just Javascript strings. I believe that
  28. Javascript has UTF-16 unicode strings and anything sent through the
  29. WebSocket gets converted to UTF-8 and vice-versa. So, one additional
  30. (and necessary) function of the proxy is base64 encoding/decoding what
  31. is sent to/from the browser. Another option that I want to explore is
  32. UTF-8 encoding in the proxy.
  33. Building web-socket-js emulator:
  34. cd include/web-socket-js/flash-src
  35. mxmlc -static-link-runtime-shared-libraries WebSocketMain.as