Open CF Summit 2012Billy Cravens
   Billy Cravens   ColdFusion since 4.0 (1999)   Houston CFUG manager   Former DFWCFUG board member   Other languages...
   Full-blown training on WebSockets   Limited to only open source engines   A spectacular demo – we’ll look at bare bo...
   An overview of options in all available CFML    engines   Highlight the role of open source solutions    across this ...
   Polling   Long-polling / Comet   Flash
   What are they?     ▪ Bi-directional, full duplex TCP communication in the       browser     ▪ Not finalized – multiple...
   Support     Browsers that support WebSockets      ▪ IE 10+, FF 6+, Chrome 14+, iOS 4.2+, BB OS7     Using Flash and ...
   node.js/socket.io     WebSockets + evented JavaScript     Complexity   PusherApp     Hosted service     Dependent
   ColdFusion < v.10   Railo   Open BlueDragon
   https://github.com/nmische/cf-websocket-    gateway   Built on Netty, non-blocking IO framework    for Java (similar ...
   Event gateway     Copy JARs and restart ColdFusion     Configure gateway type     Configure gateway instance     C...
   Event gateway     Railo allows for gateways types to be written in      CFML (ACF=Java)     Railo has extension API:...
   More info     ▪ http://wiki.getrailo.org/wiki/Extensions:WebSockets_Ga       teway
   I encountered some errors     You can report – fast to respond     You can fix – gateway is in CFML     Install scr...
   I almost made it work     fix code in install.cfc:      (railo-root)/WEB-INF/railo/temp/compress/(random      string)...
   On to the code ….
   Current release (2.02) added socket functions   Not so fast …     Raw TCP Sockets, not WebSockets        Options ...
   Simple WebSockets support   Configuration: CF Admin > Server Setting >    WebSocket     Port: for WS client     Soc...
   The code
   Advantages     Little code     More open than other approaches (Flash, Blaze      DS, etc)   Disadvantages     Lit...
Upcoming SlideShare
Loading in …5
×

Websockets

3,780 views
3,603 views

Published on

Presented at Open CF Summit 2012. Discusses options for adding WebSockets support to the different ColdFusion engines, both open source and commercial.

Published in: Technology, Education
0 Comments
1 Like
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
3,780
On SlideShare
0
From Embeds
0
Number of Embeds
1,618
Actions
Shares
0
Downloads
27
Comments
0
Likes
1
Embeds 0
No embeds

No notes for slide

Websockets

  1. 1. Open CF Summit 2012Billy Cravens
  2. 2.  Billy Cravens ColdFusion since 4.0 (1999) Houston CFUG manager Former DFWCFUG board member Other languages: PHP, .NET; node.js ninja in training Remember the Wrox book? Supporter of Cystic Fibrosis  www.CureCF.com
  3. 3.  Full-blown training on WebSockets Limited to only open source engines A spectacular demo – we’ll look at bare bones chat implementation  “I hate chat app examples” - Ray Camden In-depth knowledge of OSS roadmaps
  4. 4.  An overview of options in all available CFML engines Highlight the role of open source solutions across this entire space A review of the landscape on February 25, 2012
  5. 5.  Polling Long-polling / Comet Flash
  6. 6.  What are they? ▪ Bi-directional, full duplex TCP communication in the browser ▪ Not finalized – multiple versions ▪ ws(s)://serviceURI(:port)(/optional/path) ▪ Client side: JavaScript
  7. 7.  Support  Browsers that support WebSockets ▪ IE 10+, FF 6+, Chrome 14+, iOS 4.2+, BB OS7  Using Flash and JavaScript as polyfill ▪ https://github.com/gimite/web-socket-js ▪ The code
  8. 8.  node.js/socket.io  WebSockets + evented JavaScript  Complexity PusherApp  Hosted service  Dependent
  9. 9.  ColdFusion < v.10 Railo Open BlueDragon
  10. 10.  https://github.com/nmische/cf-websocket- gateway Built on Netty, non-blocking IO framework for Java (similar to node.js) Built on Webbit, a Java WebSocket server
  11. 11.  Event gateway  Copy JARs and restart ColdFusion  Configure gateway type  Configure gateway instance  Create CFC with WebSocket methods ▪ Open Connection ▪ Close Connection ▪ Incoming Message
  12. 12.  Event gateway  Railo allows for gateways types to be written in CFML (ACF=Java)  Railo has extension API: add gateways, libraries, etc, via Admin  Gateway based on lightweight WebSockets server ▪ https://github.com/TooTallNate/Java-WebSocket
  13. 13.  More info ▪ http://wiki.getrailo.org/wiki/Extensions:WebSockets_Ga teway
  14. 14.  I encountered some errors  You can report – fast to respond  You can fix – gateway is in CFML  Install script is CFML – you can troubleshoot
  15. 15.  I almost made it work  fix code in install.cfc: (railo-root)/WEB-INF/railo/temp/compress/(random string)/(UUID)/railo/install.cfc ▪ *** didn’t work ***  manual copy ▪ (railo-root)/WEB-INF/railo/temp/compress/(random string)/(UUID)/railo WebSocket.cfc and WebSocketListener.cfc to (railo-root)/WEB-INF/railo/components/railo/extension/gateway/ ▪ Then restart ▪ Still no WebSocket option in gateways screen  Moved WebSocketGateway.cfc from (railo root)/WEB- INF/railo/context/admin/cdriver to …../gdriver ▪ Restarted - this fixed it  Had to add mapping to components/railo directory
  16. 16.  On to the code ….
  17. 17.  Current release (2.02) added socket functions Not so fast …  Raw TCP Sockets, not WebSockets   Options  craft handshake yourself  Use a wrapper: https://github.com/kanaka/websockify  Write a wrapper: tiny little node.js script
  18. 18.  Simple WebSockets support Configuration: CF Admin > Server Setting > WebSocket  Port: for WS client  Socket Timeout  Max Data Size: default OK for most apps  Start Flash Policy Server: for Flash fallback
  19. 19.  The code
  20. 20.  Advantages  Little code  More open than other approaches (Flash, Blaze DS, etc) Disadvantages  Little analysis of the guts  Beta 1 – probably summer before gold  Commercial product

×