jchannel.server

class Server(host='localhost', port=8889, url=None, heartbeat=30)

Represents a kernel server.

Parameters:
  • host (str) – The host name.

  • port (int) – The port number.

  • url (str or None) – The URL accessed by the client. If None, it is simply f'http://{host}:{port}'. If not None, it is particularly useful when the kernel is behind a proxy.

  • heartbeat (int) – The WebSocket heartbeat interval in seconds.

property send_timeout

The post send timeout in seconds. Default is 3.

When this server receives a post request, this timeout is used to send a WebSocket response message.

property receive_timeout

As defined in aiohttp.web.WebSocketResponse.

property max_msg_size

As defined in aiohttp.web.WebSocketResponse.

property keepalive_timeout

As defined in aiohttp.web.AppRunner.

property shutdown_timeout

As defined in aiohttp.web.TCPSite.

start_client()

Starts the frontend client.

Under normal circumstances, this method should not be called. It should only be called for debugging or testing purposes.

stop_client()

Stops the frontend client.

Under normal circumstances, this method should not be called. It should only be called for debugging or testing purposes.

start()

Starts this server.

Returns:

A task that can be awaited to ensure the startup is complete.

Return type:

asyncio.Task

stop()

Stops this server.

Returns:

A task that can be awaited to ensure the shutdown is complete.

Return type:

asyncio.Task

async open(code, timeout=3)

Convenience method that instantiates a communication channel, opens this channel and returns it.

Parameters:
Returns:

The channel.

Return type:

jchannel.channel.Channel