我做了一个程序,允许我每次在unity中按空格键时发送一条消息,并使用cherrpy将其发送到python服务器。在
问题是我的websocket.py'成功地服务于本地主机如下,一旦我启动团结播放器,它只是立即关闭与错误。希望有人帮忙!!在
websocket.pyimport cherrypy
from ws4py.server.cherrypyserver import WebSocketPlugin, WebSocketTool
from ws4py.websocket import WebSocket
class Root(object):
@cherrypy.expose
def index(self):
return 'some HTML with a websocket javascript connection'
@cherrypy.expose
def ws(self):
# you can access the class instance through
handler = cherrypy.request.ws_handler
class AgentServer(WebSocket):
def opened(self):
print("Opened!")
def closed(self, code, reason):
print("Closed!")
def received_message(self,m):
self.send(m.data,m.is_binary)
if __name__ == "__main__":