Skip to content

Releases: floydous/webshocket

v0.5.1

14 Apr 02:12

Choose a tag to compare

[0.5.1] - 2026-04-14

Added

  • Streaming RPC: Server-side RPC methods can now yield values as async generators. The client iterates over streamed packets in real-time using client.stream_rpc(), enabling use cases like AI token streaming, live data feeds, and progressive result delivery.
  • Subscription Limits: Added a configurable max_subscribed_channels parameter to ClientConnection, allowing servers to cap the number of channels a single client can subscribe to.
  • Wildcard Subscriptions: Pub/Sub channels now support glob patterns (*, ?, []) for topic matching. Clients can subscribe to patterns like news.* or alerts.region.? to receive messages across multiple matching channels.
  • Pattern Cache: Replaced lru_cache with a manual _pattern_cache dictionary on WebSocketHandler for channel pattern matching, avoiding memory leaks from unbounded caching.
  • Comprehensive Test Suite: Added 50+ new tests distributed across feature-specific files:
    • test_utils.pyparse_duration edge cases (empty string, invalid unit).
    • test_predicate.py__repr__ methods on Has, Is, IsEqual, Any, All.
    • test_connection.pyrecv disconnect guard, JSON decode fallback, timeout, subscribe limits, dict-style access, __repr__, __eq__/__hash__.
    • test_internal.py — Picows server pending payload flush, double-serve rejection, client send-before-connect, extra headers.
    • test_stream.py — Streaming RPC end-to-end, mid-stream failure, concurrent streams, client-initiated abort.
    • Additions to test_handler.py, test_rpc.py, test_rate_limit.py, test_context_manager.py, test_packet.py.

Changed

  • RPCResponse Packet: Added is_stream and is_end boolean flags to RPCResponse to support the streaming protocol. is_stream=True marks a response as part of a streaming sequence; is_end=True signals the final packet.
  • RPCMethod Metadata: The RPC decorator now detects async generator functions and tags them as streaming methods via RPCMethod.is_stream.
  • rpc.py Decorator Validation: Both @rpc_method() and @rate_limit() now raise TypeError immediately if applied to a non-async function, preventing silent runtime failures.

Fixed

  • Streaming Error Propagation: Fixed a protocol bug where rate-limit and access-denied errors in streaming RPCs were not flagged with is_stream=True and is_end=True, causing client-side stream_rpc() iterators to hang indefinitely waiting for an end signal.
  • stream_rpc Rate Limit: stream_rpc() now correctly raises RateLimitError locally when raise_on_rate_limit=True is set, matching the behavior of send_rpc().
  • Port Collision in Tests: Shifted integration test ports to higher ranges (5003-5050) to avoid OSError: [Errno 10048] on Windows caused by TCP TIME_WAIT state from prior test runs.

v0.5.0

11 Feb 04:51

Choose a tag to compare

[0.5.0] - 2026-02-11

Changed

  • Picows Migration: Replaced websockets with picows for handling WebSocket frames. This significantly improves performance and reduces memory usage.
  • Native Fragmentation: Implemented native WebSocket fragmentation support. Large payloads are now automatically split into 64KB chunks.
  • Async Mismatch Fixes: Fixed type hint inconsistencies where client.send was marked as async but implemented as synchronous.

Added

  • Graceful Shutdown: Improved server.close() to send proper Close frames (GOAWAY) to all clients before shutting down.
  • Chunking Tests: Added comprehensive tests for 64KB payload boundaries and large message handling.

v0.4.0

20 Jan 04:17

Choose a tag to compare

[0.4.0] - 2026-01-20

Added

  • New Logging System: You can now easily see what is happening inside the server, client, and connections. This makes it much easier to debug your apps by turning logs on or off.
  • Better IDE Support: Improved type hints for session states and RPC responses. This means better "autocomplete" and fewer coding errors while you work in your code editor.
  • Better Debug Info: When you look at connections or filters in a debugger, they now show much clearer information.
  • Access Control Rules: Introduced a simple way to set rules for who can call your functions. You can use rules like IsEqual, Has, Any, or All to quickly secure your server.

Changed

  • Much Faster Performance: Changed how data is handled to make it much faster. This reduces the delay and CPU usage for every message sent and received.
  • Faster RPC Calls: Redesigned the RPC engine to be much more efficient, making remote function calls feel snappy even when the server is busy.
  • Better Binary Support: Improved the way raw data and structured packets are handled so the library runs smoother.

Fixed

  • Better Data Validation: Fixed the rules for checking data to make sure messages are always correct and consistent.
  • Channel Fixes: Fixed a bug where data sent to channels was sometimes labeled incorrectly.
  • General Cleanup: Removed old debug messages and internal code that was slowing things down.

Breaking Changes

  • Updated Dependencies: Removed pydantic and msgpack to use a faster, built-in way of handling data.
  • Compatibility: The message format has changed to improve speed. Both your client and server need to be updated to version 0.3.0 to work together.

v0.3.0

18 Aug 09:21

Choose a tag to compare

[0.3.0] - 2025-8-18

Added

  • Improved compatibility: Other WebSocket modules from different languages can now interact with the Webshocket server. Check the docs for more information.
  • Added a requires keyword argument to webshocket.rpc_method for custom access control.
  • register_rpc_method added to WebSocketServer for manual addition to RPC Function
  • Disconnected client will automatically unsubscribe from all channels.

Fixed

  • Fixed a bug where an RPC function would not respond when it returned a falsy type as its return object.
  • When an RPC method returns no value, an RPC response is sent with None as its result.

Changed

  • send_rpc function now returns the response of the RPC calls.
  • The example code in the folder example/ was refactored to demonstrate Webshocket's full potential
  • ClientConnection.publish() can now accept an Iterable of channel names

v0.2.5

27 Jul 03:25

Choose a tag to compare

[0.2.5] - 2025-07-27

Added

  • max_connection parameter to WebSocketServer to limit the number of concurrent connections.
  • Added RPCErrorCode Enum to represent RPC Response codes.
  • Few logging for debugging.

Fixed

  • Fixed the close() function for ClientConnection where it doesn't immediately change the connection_state to CLOSED
  • Fixed type hinting for ClientConnection

Changed

  • Serialization method for Packet data is switched from base64 to msgpack (binary)
  • Packet data is no longer restricted for bytes or string, it can be anything as long it's serializeable with msgpack
  • RPCResponse is now only consisnt of call_id (String), response (Any), and error (RPCErrorCode)

v0.2.0

08 Jul 17:00

Choose a tag to compare

[0.2.0] - 2025-07-09

Added

  • RPC Rate Limiting: Introduced a @rate_limit decorator for handler methods to prevent abuse and manage server load by controlling how frequently clients can call specific functions.

Changed

  • Enhanced Data Protocol: The internal packet system now supports sending raw bytes payloads. Binary data is automatically and safely transported by Base64-encoding it within the standard JSON packet structure, making the protocol more flexible.

v0.1.5

27 Jun 09:44

Choose a tag to compare

  • Added: RPC (Remote Procedure Call) Support

    • Added @rpc_method to easily make your handler methods callable.
    • New send_rpc method on the client to kick off remote calls.
    • client.recv now automatically grabs RPC results/errors for you.
    • Packets can now carry RPC stuff.
  • Fixed: Type Stuff and Imports

    • Cleaned up some type hints and import issues for the new RPC feature.