Hi,<div><br></div><div>Thanks a lot for your clarification. My problems have been resolved. Actually, I shifted to Autobahn. It&#39;s way comfortable in editing the examples there. Now, I got the way to deal with txWS too indeed. The answer to what I asked is just about grabbing the endpoints and use them at times. In Autobahn broadcast example, they store all the clients when the connection is opened as shown below:</div>
<div><br></div><div><div> def onOpen(self):</div><div>      self.factory.register(self)</div></div><div><br></div><div>And in factory, the register function is this way: </div><div><br></div><div><div> def register(self, client):</div>
<div>      if not client in self.clients:</div><div>         print &quot;registered client &quot; + client.peerstr</div><div>         self.clients.append(client)</div></div><div><br></div><div>So, this way I can send to all clients whenever I want as follows:</div>
<div> ......some code .....</div><div>  for c in self.clients:</div><div>         c.sendMessage(json_event)</div><div>......some code........</div><div><br></div><div>Anyways, I have implemented my scenario pretty well using Autobahn. I&#39;m sure I can do the same with txWS at times. </div>
<div><br></div><div>Thanks,</div><div>Vinodh<br><div class="gmail_quote">On Sun, Jul 1, 2012 at 12:03 PM, Corbin Simpson <span dir="ltr">&lt;<a href="mailto:cds@corbinsimpson.com" target="_blank">cds@corbinsimpson.com</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="im">On Sat, Jun 30, 2012 at 09:36:08PM +0200, vinod kumar wrote:<br>
&gt; Hi,<br>
&gt;<br>
&gt;  Thanks a lot for your reply. The trouble is that the events I have are<br>
&gt; triggered by a homematic CCU. The CCU does it by multicall which has not<br>
&gt; yet been implemented in twisted servers. So, I&#39;m running a non-twisted<br>
&gt; xmlrpc server in a thread so that my CCU triggers the events and it&#39;s<br>
&gt; happening too. I can see the events printed on the console too. Now, I just<br>
&gt; want a way to write the same to sockets. Can&#39;t we connect these to txWS<br>
&gt; factory ? Doesn&#39;t the txWS has some socket object so that we can just say<br>
&gt; socket.write..hmm<br>
<br>
</div>Well, no, txWS doesn&#39;t have raw sockets like that. Let me try to ASCII<br>
things out.<br>
<br>
In a normal Twisted TCP server, you might have some situation like this:<br>
<br>
+---------------------------+<br>
| ServerFactory             |<br>
|                           |           +----+<br>
| + - - - - -+ +- - - - - + |~Raw~Bytes~|Port|~~TCP~~<br>
| | Protocol | | Protocol | |           +----+<br>
| +- - - - - + + - - - - -+ |<br>
+---------------------------+<br>
<br>
In this scenario, the Port is bound to a ServerFactory, and each<br>
Protocol of the Factory corresponds to a single TCP client. Protocols<br>
should contain all of the logic necessary for communicating with their<br>
given client. If necessary, the Factory could track all of its<br>
Protocols, in order to facilitate cross-Protocol communication.<br>
<br>
So, with that in mind, here&#39;s what txWS provides:<br>
<br>
+---------------------------+<br>
| WebSocketsFactory         |<br>
|                           |=WebSockets=Framing=+----+<br>
| + - - - - - - - +         |~~~~~~Raw~Bytes~~~~~|Port|~~TCP~~<br>
| | ServerFactory |         |====================+----+<br>
| +- - - - - - - -+         |<br>
+---------------------------+<br>
<br>
That is, WebSocketsFactory wraps a ServerFactory and armors all of the<br>
bytes being sent with WebSockets frames. There isn&#39;t any magic in there;<br>
it&#39;s all compositional and very straightforward.<br>
<br>
I&#39;m not sure what you want when you say that you &quot;want a way to write<br>
the same to sockets.&quot; txWS doesn&#39;t have any special insight into the<br>
bottom layer of its connection. (It could even work on non-TCP, if<br>
somebody really wanted that.)<br>
<br>
I hope this clarifies things; I know it doesn&#39;t exactly answer your<br>
question as stated.<br>
<span class="HOEnZb"><font color="#888888"><br>
~ C.<br>
</font></span></blockquote></div><br></div>