subscribe
The subscribe method subscribes to a published remote table that matches the specified ticket.
Note
If the remote table is closed or its owner session is closed, the ticket becomes invalid. If the same ticket is subscribed multiple times, multiple subscriptions will be created.
Syntax
Parameters
| Parameter | Type | Description |
|---|---|---|
| ticket | bytes | The bytes of the ticket. |
Returns
A Table that is a subscribed to the remote table.
Examples
The following example installs the Deephaven Python Client (pydeephaven) on a Deephaven server running on port 10001. It also starts a Deephaven server running locally on port 10000 with anonymous authentication.
Next, the client creates a table on the server on port 10000. A shared ticket is created that publishes the table, which allows it to be shared with other sessions. Finally, a Barrage session is started that listens to the server on port 10000, and a new local table that is subscribed to the shared ticket's table is obtained.
Important
Shared tickets have a life cycle tied to the source. Tickets can be fetched by other Deephaven sessions to access the table only as long as the table is not released. When the table is released either through an explicit call of the close method, implicitly through garbage collection, or through the closing of the publishing session, the shared ticket will no longer be valid.