我正在尝试使用python和signal r库调用服务器。我尝试连接到服务器,然后尝试从集线器调用我的方法,但出现错误。
AttributeError:'NoneType'对象没有属性'send'
当我使用seesion=None
from requests import Session
from signalr import Connection
def main():
with Session() as session:
connection = Connection("http://localhost:8089", session=None)
presenceservice = connection.register_hub('MyHub')
key = input("Press E\n")
while connection:
if key == 'e':
presenceservice.server.invoke('Heartbeat')
print("Client Heartbeat sent to the server")
presenceservice.client.on('Heartbeat', print("Recieved Heartbeat \n"))
if __name__ == "__main__":
main()
我也用session
进行了尝试,但出现以下错误
在凸起状态中的引发HTTPError(http_error_msg,response = self) requests.exceptions.HTTPError:500服务器错误:URL的内部服务器错误:http://localhost:8089/signalR/negotiate?connectionData=%5B%7B%22name%22%3A+%22corehub%22%7D%5D&clientProtocol=1.5