def main(): log.startLogging(sys.stdout) root = File(".") site = WebSocketSite(root) site.addHandler("/ws/echo", ChattyHandler) reactor.listenTCP(8080, site) reactor.run()
def main(): log.startLogging(sys.stdout) root = File("/home/slashroot/workspace/slashrootcafe/push/websocket_server") site = WebSocketSite(root) site.addHandler("ws/echo", Echohandler) reactor.listenTCP(7000, site) reactor.run()
def main(): from twisted.internet import reactor log.startLogging(sys.stdout) root = static.File('.') site = WebSocketSite(root) site.addHandler("/ws/chat", ChatHandler) reactor.listenTCP(9876, site) reactor.run()
def main(): log.startLogging(sys.stdout) root = File(".") site = WebSocketSite(root) site.addHandler("/ws/echo", echo_factory) reactor.listenTCP(8080, site) #listen to stomp reactor.connectTCP('localhost', 61613, StompClientFactory()) reactor.run()
self.connections.remove(p) self.post_message('chat server', '%s disconnected' % p.host) def post_message(self, from_addr, message): for p in self.connections: p.sendMessage('%s:%s' % (from_addr, message)) if __name__ == '__main__': log.startLogging(sys.stdout) root = File(".") logging.basicConfig(level=logging.DEBUG) factory = ChatFactory() site = WebSocketSite(root) site.addHandler("/ws/echo", ChatWebsocketProtocol) reactor.listenTCP(8007, factory) reactor.run() # from twisted.internet.ssl import PrivateCertificate # from twisted.protocols.tls import TLSMemoryBIOFactory # certificate = PrivateCertificate.loadPEM(certPEMData) # contextFactory = certificate.options() # tlsFactory = TLSMemoryBIOFactory(contextFactory, False, factory) # reactor.listenTCP(8008, tlsFactory) reactor.run()
from twisted.internet import reactor from twisted.web.websocket import WebSocketHandler, WebSocketSite from twisted.web.static import File class Echohandler(WebSocketHandler): def frameReceived(self, frame): self.transport.write(frame) if __name__ == '__main__': root = File('.') site = WebSocketSite(root) site.addHandler('/echo', Echohandler) reactor.listenTCP(8080, site) reactor.run()
from twisted.internet import reactor from twisted.web.websocket import WebSocketHandler, WebSocketSite from twisted.web.static import File class Echohandler(WebSocketHandler): def frameReceived(self, frame): self.transport.write(frame) if __name__ == "__main__": root = File(".") site = WebSocketSite(root) site.addHandler("/echo", Echohandler) reactor.listenTCP(8080, site) reactor.run()