Skip to main content

Websocket Client Library

Project description

# Dataplicity Lomond

Tranquil WebSockets for Python. [Docs](https://lomond.readthedocs.io/)

Lomond is a Websocket client which turns a websocket connection in to
an orderly stream of _events_. No threads or callbacks necessary.

## How to Use

First construct a `WebSocket` object, then iterate over it to generate
an orderly sequence of events.

## Example

The following is a silly example that connects to a websocket server
(in this case a public echo server), and sends a string of text
every 5 seconds.


```python
from lomond import WebSocket

websocket = WebSocket('wss://echo.websocket.org')
for event in websocket:
if event.name == 'poll':
websocket.send_text('Hello, World')
elif event.name == 'text':
print(event.text)
```


## Events

A successful websocket connection will result in a series of events
such as the following:

```
┌──────────────────────┐
│ Connecting │ Contacting server
└──────────────────────┘


┌──────────────────────┐ Connected to server (but
│ Connected │ not yet sent data)
└──────────────────────┘


┌──────────────────────┐ Negotiated Websocket
│ Ready │ handshake
└──────────────────────┘
│ ┌───────────┐
│ │ │
▼ ▼ │
┌──────────────────────┐ │ Send and receive
│ Binary / Text / Poll │──┘ application data
└──────────────────────┘


┌──────────────────────┐ Websocket close
│ Closed │ handshake
└──────────────────────┘


┌──────────────────────┐
│ Disconnected │ Disconnected TCP/IP
└──────────────────────┘ connection to server
```

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

lomond-0.1.13a0.tar.gz (21.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

lomond-0.1.13a0-py2.py3-none-any.whl (29.2 kB view details)

Uploaded Python 2Python 3

File details

Details for the file lomond-0.1.13a0.tar.gz.

File metadata

  • Download URL: lomond-0.1.13a0.tar.gz
  • Upload date:
  • Size: 21.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for lomond-0.1.13a0.tar.gz
Algorithm Hash digest
SHA256 838c09e067c397a2b743d0ccd9267afda5d42f4218cbf90fbc0311e4aa2d8ef4
MD5 225ca05d916488dad81806d54b195639
BLAKE2b-256 41af6acbfcfa0254187db5c7cc95495337b63cb7a66044801e7ddc21966222e6

See more details on using hashes here.

File details

Details for the file lomond-0.1.13a0-py2.py3-none-any.whl.

File metadata

File hashes

Hashes for lomond-0.1.13a0-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 7d6e9c7fe0a043dbaafbf120ebb1e8224f1c20d8ad7a6fbf55e684fd3573f297
MD5 490e4982b5c0db095ca5aebd79b51735
BLAKE2b-256 5e6e0e68f46285ccc02ce2f74b3b92b0aa33992279c7334231d7aedd10da0d42

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page