// Comment
import cherrypy
from ws4py.server.cherrypyserver import WebSocketPlugin, WebSocketTool
from ws4py.websocket import EchoWebSocket
cherrypy.config.update({'server.socket_port': 8877})
WebSocketPlugin(cherrypy.engine).subscribe()
cherrypy.tools.websocket = WebSocketTool()
import codecs
class Root(object):
@cherrypy.expose
def index(self):
return 'some HTML with a websocket javascript connection'
@cherrypy.expose
def page(self):
with codecs.open("client.html", "r", "utf_8") as fp:
return fp.read()
if __name__ == '__main__':
import sys
port = sys.argv[1]
cherrypy.config.update({'server.socket_port': int(port)})
cherrypy.quickstart(Root(), "/")
댓글
댓글 쓰기