Skip to main content

ws2udp

A WebSocket to UDP proxy.

ws2udp will forward messages coming from the WebSocket server to UDP sockets, it is especially useful to send OSC messages from JavaScript applications to SuperCollider or any other software that doesn't support WebSockets. It registers all websockets connected and will broadcast messages sent to its own UDP port.

Installation

You will need Python>=3.7 and the websockets package.

The simplest way to install is using pip:

$ pip install ws2udp

Example

$ ws2udp
WebSocket to UDP proxy

optional arguments:
  -h, --help           show this help message and exit
  --udp-addr UDP_ADDR  Address of the UDP receiver for broadcasting messages (default=localhost)
  --udp-port UDP_PORT  Port of the UDP receiver (default=57142)
  --fwd-fixed          Forward UDP to fixed target address/port
  --fwd-addr FWD_ADDR  Address of the UDP target for messages (default=localhost)
  --fwd-port FWD_PORT  Port of the UDP target (default=57143)
  --addr ADDR          WebSocket address to listen (default=0.0.0.0)
  --port PORT          WebSocket port to listen (default=8765)
  --broadcast          Enable UDP broadcasting
  --quiet              No verbose output

If the fwd-fixed option is not given (default behavior), the server expects binary messages following the format:

address_length(uint32)address(string)port(uint32)data

  • address_length is an integer representing the total length of the address
  • address the address where to forward the data as a string (example: localhost)
  • port as an integer
  • data the original message data

For example, to send the message hello world to localhost:57120, one would send:

b'\x09\x00\x00\x00localhost\x20\xdf\x00\x00hello, world'

The first 4 bytes b'\x09\x00\x00\x00 represents 9, then comes b'localhost' and lastly b'\x20\xdf\x00\x00' for 57120. Whatever comes after this is forwarded.

If the fwd-fixed option is given, the original message data will be forwarded unaltered.

Release files for ws2udp 0.1.7

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for ws2udp 0.1.7
File Size Uploaded
ws2udp-0.1.7.tar.gz 17.3 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for ws2udp 0.1.7
File Interpreter ABI Platform
ws2udp-0.1.7-py3-none-any.whl Python 3 none any Details

Total release size: 35.2 kB

Release files / ws2udp-0.1.7.tar.gz

Download URL ws2udp-0.1.7.tar.gz
Size 17.3 kB
Tags Source
SHA-256 checksum
How to use checksums
cddd1c59c7885727822a74dc3e002b6c48e07a1ebd92fd0b850c3eb426bfac89
BLAKE2b-256 checksum
How to use checksums
144838b25f3ee94e608e98a8467fd2af29e21a66fcced6f5c1589d954d5cd28f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.0.0 CPython/3.12.3

Release files / ws2udp-0.1.7-py3-none-any.whl

Download URL ws2udp-0.1.7-py3-none-any.whl
Size 17.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
5c0447980885ca940374f5829f7cc21ae6c4ce1fe2a8c01ff5edeb70024b44a8
BLAKE2b-256 checksum
How to use checksums
86d2e3bcdfb25085e0d2353bd5ea8a051607069f06933f2bf9369b020cd66aaf
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.0.0 CPython/3.12.3

Release history Release notifications | RSS feed

This release

0.1.7 This release

2 release files

0.1.6

1 release file

0.1.5

2 release files

0.1.4

2 release files

0.1.3

2 release files

0.1.2

2 release files

0.1.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page