1- 我正在尝试订阅特定频道并从一台服务器进行长轮询,但我收到客户端未知错误 402。以前有人遇到过这个问题吗?代码中缺少什么?
import asyncio
from aiocometd import Client
import aiocometd.exceptions as cometd_exc
from aiocometd import Client, ConnectionType
IP= "x.x.x.x"
#Handshaking
async def main():
async with Client("http://"+IP+":8081/events/server/cometd",connection_timeout=60 , connection_types=ConnectionType.LONG_POLLING) as client:
await client.subscribe("/events/rest/alarmEvent")
async for message in client:
print(message)
try:
message = await client.receive()
except TransportTimeoutError:
print("Connection is lost with the server. "
"Couldn't reconnect in 60 seconds.")
if __name__ == "__main__":
loop = asyncio.get_event_loop()
loop.run_until_complete(main())
'Error code 402 //Unknown Client'