|
| 1 | +<!-- markdownlint-disable --> |
| 2 | + |
| 3 | +<a href="..\src\spacetimedb_sdk\spacetimedb_async_client.py#L0"><img align="right" style="float:right;" src="https://img.shields.io/badge/-source-cccccc?style=flat-square"></a> |
| 4 | + |
| 5 | +# <kbd>module</kbd> `src.spacetimedb_sdk.spacetimedb_async_client` |
| 6 | +SpacetimeDB Python SDK AsyncIO Client |
| 7 | + |
| 8 | +This module provides a client interface to your SpacetimeDB module using the asyncio library. Essentially, you create your client object, register callbacks, and then start the client using asyncio.run(). |
| 9 | + |
| 10 | +For details on how to use this module, see the documentation on the SpacetimeDB website and the examples in the examples/asyncio directory. |
| 11 | + |
| 12 | + |
| 13 | + |
| 14 | +--- |
| 15 | + |
| 16 | +<a href="..\src\spacetimedb_sdk\spacetimedb_async_client.py#L19"><img align="right" style="float:right;" src="https://img.shields.io/badge/-source-cccccc?style=flat-square"></a> |
| 17 | + |
| 18 | +## <kbd>class</kbd> `SpacetimeDBException` |
| 19 | + |
| 20 | + |
| 21 | + |
| 22 | + |
| 23 | + |
| 24 | + |
| 25 | + |
| 26 | + |
| 27 | +--- |
| 28 | + |
| 29 | +<a href="..\src\spacetimedb_sdk\spacetimedb_async_client.py#L22"><img align="right" style="float:right;" src="https://img.shields.io/badge/-source-cccccc?style=flat-square"></a> |
| 30 | + |
| 31 | +## <kbd>class</kbd> `SpacetimeDBScheduledEvent` |
| 32 | + |
| 33 | + |
| 34 | + |
| 35 | + |
| 36 | +<a href="..\src\spacetimedb_sdk\spacetimedb_async_client.py#L23"><img align="right" style="float:right;" src="https://img.shields.io/badge/-source-cccccc?style=flat-square"></a> |
| 37 | + |
| 38 | +### <kbd>method</kbd> `SpacetimeDBScheduledEvent.__init__` |
| 39 | + |
| 40 | +```python |
| 41 | +__init__(datetime, callback, args) |
| 42 | +``` |
| 43 | + |
| 44 | + |
| 45 | + |
| 46 | + |
| 47 | + |
| 48 | + |
| 49 | + |
| 50 | + |
| 51 | + |
| 52 | +--- |
| 53 | + |
| 54 | +<a href="..\src\spacetimedb_sdk\spacetimedb_async_client.py#L28"><img align="right" style="float:right;" src="https://img.shields.io/badge/-source-cccccc?style=flat-square"></a> |
| 55 | + |
| 56 | +## <kbd>class</kbd> `SpacetimeDBAsyncClient` |
| 57 | + |
| 58 | + |
| 59 | + |
| 60 | + |
| 61 | +<a href="..\src\spacetimedb_sdk\spacetimedb_async_client.py#L35"><img align="right" style="float:right;" src="https://img.shields.io/badge/-source-cccccc?style=flat-square"></a> |
| 62 | + |
| 63 | +### <kbd>method</kbd> `SpacetimeDBAsyncClient.__init__` |
| 64 | + |
| 65 | +```python |
| 66 | +__init__(autogen_package) |
| 67 | +``` |
| 68 | + |
| 69 | +Create a SpacetimeDBAsyncClient object |
| 70 | + |
| 71 | + |
| 72 | + |
| 73 | +**Attributes:** |
| 74 | + |
| 75 | + - <b>`autogen_package `</b>: package folder created by running the generate command from the CLI |
| 76 | + |
| 77 | + |
| 78 | + |
| 79 | + |
| 80 | +--- |
| 81 | + |
| 82 | +<a href="..\src\spacetimedb_sdk\spacetimedb_async_client.py#L179"><img align="right" style="float:right;" src="https://img.shields.io/badge/-source-cccccc?style=flat-square"></a> |
| 83 | + |
| 84 | +### <kbd>method</kbd> `SpacetimeDBAsyncClient.call_reducer` |
| 85 | + |
| 86 | +```python |
| 87 | +call_reducer(reducer_name, *reducer_args) |
| 88 | +``` |
| 89 | + |
| 90 | +Call a reducer on the async loop. This function will not return until the reducer call completes. |
| 91 | + |
| 92 | +NOTE: DO NOT call this function if you are using the run() function. You should use the auto-generated reducer functions instead. |
| 93 | + |
| 94 | +Args: reducer_name : name of the reducer to call reducer_args (variable) : arguments to pass to the reducer |
| 95 | + |
| 96 | +--- |
| 97 | + |
| 98 | +<a href="..\src\spacetimedb_sdk\spacetimedb_async_client.py#L211"><img align="right" style="float:right;" src="https://img.shields.io/badge/-source-cccccc?style=flat-square"></a> |
| 99 | + |
| 100 | +### <kbd>method</kbd> `SpacetimeDBAsyncClient.close` |
| 101 | + |
| 102 | +```python |
| 103 | +close() |
| 104 | +``` |
| 105 | + |
| 106 | +Close the client. This function will not return until the client is closed. |
| 107 | + |
| 108 | +NOTE: DO NOT call this function if you are using the run() function. It will close for you. |
| 109 | + |
| 110 | +--- |
| 111 | + |
| 112 | +<a href="..\src\spacetimedb_sdk\spacetimedb_async_client.py#L135"><img align="right" style="float:right;" src="https://img.shields.io/badge/-source-cccccc?style=flat-square"></a> |
| 113 | + |
| 114 | +### <kbd>method</kbd> `SpacetimeDBAsyncClient.connect` |
| 115 | + |
| 116 | +```python |
| 117 | +connect(auth_token, host, address_or_name, ssl_enabled, subscription_queries=[]) |
| 118 | +``` |
| 119 | + |
| 120 | +Connect to the server. |
| 121 | + |
| 122 | +NOTE: DO NOT call this function if you are using the run() function. It will connect for you. |
| 123 | + |
| 124 | + |
| 125 | + |
| 126 | +**Args:** |
| 127 | + |
| 128 | + - <b>`auth_token `</b>: authentication token to use when connecting to the server |
| 129 | + - <b>`host `</b>: host name or IP address of the server |
| 130 | + - <b>`address_or_name `</b>: address or name of the module to connect to |
| 131 | + - <b>`ssl_enabled `</b>: True to use SSL, False to not use SSL |
| 132 | + - <b>`subscription_queries `</b>: list of queries to subscribe to |
| 133 | + |
| 134 | +--- |
| 135 | + |
| 136 | +<a href="..\src\spacetimedb_sdk\spacetimedb_async_client.py#L78"><img align="right" style="float:right;" src="https://img.shields.io/badge/-source-cccccc?style=flat-square"></a> |
| 137 | + |
| 138 | +### <kbd>method</kbd> `SpacetimeDBAsyncClient.force_close` |
| 139 | + |
| 140 | +```python |
| 141 | +force_close() |
| 142 | +``` |
| 143 | + |
| 144 | +Signal the client to stop processing events and close the connection to the server. |
| 145 | + |
| 146 | +This will cause the client to close even if there are scheduled events that have not fired yet. |
| 147 | + |
| 148 | +--- |
| 149 | + |
| 150 | +<a href="..\src\spacetimedb_sdk\spacetimedb_async_client.py#L91"><img align="right" style="float:right;" src="https://img.shields.io/badge/-source-cccccc?style=flat-square"></a> |
| 151 | + |
| 152 | +### <kbd>method</kbd> `SpacetimeDBAsyncClient.run` |
| 153 | + |
| 154 | +```python |
| 155 | +run( |
| 156 | + auth_token, |
| 157 | + host, |
| 158 | + address_or_name, |
| 159 | + ssl_enabled, |
| 160 | + on_connect, |
| 161 | + subscription_queries=[] |
| 162 | +) |
| 163 | +``` |
| 164 | + |
| 165 | +Run the client. This function will not return until the client is closed. |
| 166 | + |
| 167 | + |
| 168 | + |
| 169 | +**Args:** |
| 170 | + |
| 171 | + - <b>`auth_token `</b>: authentication token to use when connecting to the server |
| 172 | + - <b>`host `</b>: host name or IP address of the server |
| 173 | + - <b>`address_or_name `</b>: address or name of the module to connect to |
| 174 | + - <b>`ssl_enabled `</b>: True to use SSL, False to not use SSL |
| 175 | + - <b>`on_connect `</b>: function to call when the client connects to the server |
| 176 | + - <b>`subscription_queries `</b>: list of queries to subscribe to |
| 177 | + |
| 178 | +--- |
| 179 | + |
| 180 | +<a href="..\src\spacetimedb_sdk\spacetimedb_async_client.py#L47"><img align="right" style="float:right;" src="https://img.shields.io/badge/-source-cccccc?style=flat-square"></a> |
| 181 | + |
| 182 | +### <kbd>method</kbd> `SpacetimeDBAsyncClient.schedule_event` |
| 183 | + |
| 184 | +```python |
| 185 | +schedule_event(delay_secs, callback, *args) |
| 186 | +``` |
| 187 | + |
| 188 | +Schedule an event to be fired after a delay |
| 189 | + |
| 190 | +To create a repeating event, call schedule_event() again from within the callback function. |
| 191 | + |
| 192 | + |
| 193 | + |
| 194 | +**Args:** |
| 195 | + |
| 196 | + - <b>`delay_secs `</b>: number of seconds to wait before firing the event |
| 197 | + - <b>`callback `</b>: function to call when the event fires |
| 198 | + - <b>`args`</b> (variable): arguments to pass to the callback function |
| 199 | + |
| 200 | + |
| 201 | + |
| 202 | + |
| 203 | +--- |
| 204 | + |
| 205 | +_This file was automatically generated via [lazydocs](https://github.com/ml-tooling/lazydocs)._ |
0 commit comments