Created
March 12, 2012 20:30
-
-
Save MostAwesomeDude/2024501 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from twisted.python import log | |
| from sys import stdout | |
| log.startLogging(stdout) | |
| from twisted.internet.protocol import Protocol, Factory | |
| class EchoProtocol(Protocol): | |
| def dataReceived(self, data): | |
| self.transport.write(data) | |
| class EchoFactory(Factory): | |
| protocol = EchoProtocol | |
| from twisted.application.strports import listen | |
| from twisted.web.server import Site | |
| from twisted.web.websockets import WebSocketsResource | |
| port = listen("tcp:5600", Site(WebSocketsResource(EchoFactory()))) | |
| from twisted.internet import reactor | |
| reactor.run() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment