Skip to content

koodaamo/collective.websocketclient

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

22 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Introduction
============

Send test messages via the `@@websocketsend` view, using either GET or POST. Pass a single
argument called `msg`, containing the message to be sent.

Code usage example::

   import socket
   from zope.component import getUtility
   from websocket._exceptions import WebSocketConnectionClosedException
   from .interfaces import IWebSocketConnectionManager

   manager = getUtility(IWebSocketConnectionManager)
   connection = manager.getConnection()
   
   if connection is None:
      print "could not connect!"
   else:
      try:
         connection.send(msg)
         print self.connection.receive()
      except (WebSocketConnectionClosedException, socket.error):
      
         # failed; if you want to retry, do so by first getting a new
         # connection, ie. call manager.getConnection() again
         print "failure!"
  

About

Configure, open & maintain a persistent websocket connection

Topics

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages