Getting a 402 client unknown while trying to handshake with a CometD /Bayeux server

191 views Asked by At

1- I'm trying to subscribe to a specific channel and to get a long-polling from one server, but I receive a client unknown Error 402. Did anyone face this issue before? Anything missing within the code?

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'
        
0

There are 0 answers