Questions tagged [cfwebsocket]

Lets you create the WebSocket object in your CFM template.

Lets you create the WebSocket object in your CFM template. The tag creates a reference to the WebSocket JavaScript object at the client-side.

Example

In the following example,

  • The user is automatically subscribed to the stocks channel.
  • You have specified the channel name in the Application.cfc.
  • The example uses the default channel listener.

In the Index.cfm, you specify the channels to which the user can automatically subscribe to (using the attribute subscribeTo) and also define the message handler.

Application.cfc

{ this.name="websocketsampleapp1"; this.wschannels=[{name="stocks"}]; }

Index.cfm

<script type="text/javascript"> function mymessagehandler(aevent, atoken) { var message = ColdFusion.JSON.encode(atoken); var txt=document.getElementById("myDiv"); txt.innerHTML +=message +"<br>"; } </script> <cfwebsocket name="mycfwebsocketobject" onmessage="mymessagehandler" subscribeto="stocks" > <cfdiv id="myDiv"> </cfdiv>

The code creates a JavaScript WebSocket object named mycfwebsocketobject. If the server sends a message, it calls mymessagehandler function.Since you have specified subscribeTo in the cfwebsocket tag, the WebSocket object automatically subscribes you to the channel stocks.

https://learn.adobe.com/wiki/display/coldfusionen/cfwebsocket

18 questions
14
votes
4 answers

CF10 websocket p2p can invoke any public functions in any CFC from JavaScript. How is this Not a security risk?

In Using WebSocket in point-to-point communication in Adobe ColdFusion 10 Dev Guide, the javascript object mysocket created by can call an invoke() method that can literally invoke Any public method on Any CFC from JavaScript. How is…
Henry
  • 32,689
  • 19
  • 120
  • 221
7
votes
3 answers

Coldfusion 10 - Live One on One chat with Websockets

Does anyone know of any examples or pages that I can go to that implements a Live one on one chat using the CF10 Websockets? All the examples I found on the net were those of group chats where users subscribes to a certain channel. I need it so…
Guest
  • 381
  • 2
  • 7
  • 22
6
votes
1 answer

Can cfwebsocket be used without the generated JavaScript mess?

When CF8 brought us ajax support, and various tags made ajax with CF real easy, but invoking cfc?method= is also possible with any JS lib, and one can get away with including those horrific JavaScript from Adobe. Now that CF10…
Henry
  • 32,689
  • 19
  • 120
  • 221
6
votes
4 answers

Does CF10 support secure websocket wss?

Can someone using CF10 confirm if CF10 supports secure websocket wss://? http://blog.kaazing.com/2012/02/28/html5-websocket-security-is-strong/
Henry
  • 32,689
  • 19
  • 120
  • 221
3
votes
1 answer

Tag Library supports namespace: http://xmlns.jcp.org/jsf/core, but no tag was defined for name: websocket

I'm upgrading jsf 2.2 to jsf 2.3, using wildfly 11.0.0 Beta as server. i follow the instructions on this site. http://arjan-tijms.omnifaces.org/p/jsf-23.html#1396 Server starts well and the application works fine. When i call the push.xhtml…
CSekem
  • 33
  • 5
3
votes
2 answers

Coldfusion Websockets "User is typing..." Functionality

I'm playing around with Coldfusion 10's websockets and made a simple chat for testing. I've seen several chats where they have the "user is typing..." text that shows up when the other user is typing. Does anyone know how to implement this…
Guest
  • 381
  • 2
  • 7
  • 22
2
votes
0 answers

What is the appropriate way to deal with cfWebSocket timing out?

Some pages of our application establish a websocket connection to a channel specific to the user. Messages are published to this channel on an irregular basis (sometimes within a few seconds, sometimes not for 30-60 minutes or longer), allowing our…
Nicholas
  • 1,974
  • 4
  • 20
  • 46
2
votes
0 answers

websocket object is not initialized when using jquery cdn

I have written two files. Application.cfc component output="false"{ this.name = "WebSocket"; this.wschannels = [{name:"news"}]; } Index.cfm