Releases: floydous/webshocket
Releases · floydous/webshocket
v0.5.1
[0.5.1] - 2026-04-14
Added
- Streaming RPC: Server-side RPC methods can now
yieldvalues as async generators. The client iterates over streamed packets in real-time usingclient.stream_rpc(), enabling use cases like AI token streaming, live data feeds, and progressive result delivery. - Subscription Limits: Added a configurable
max_subscribed_channelsparameter toClientConnection, 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 likenews.*oralerts.region.?to receive messages across multiple matching channels. - Pattern Cache: Replaced
lru_cachewith a manual_pattern_cachedictionary onWebSocketHandlerfor channel pattern matching, avoiding memory leaks from unbounded caching. - Comprehensive Test Suite: Added 50+ new tests distributed across feature-specific files:
test_utils.py—parse_durationedge cases (empty string, invalid unit).test_predicate.py—__repr__methods onHas,Is,IsEqual,Any,All.test_connection.py—recvdisconnect 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
RPCResponsePacket: Addedis_streamandis_endboolean flags toRPCResponseto support the streaming protocol.is_stream=Truemarks a response as part of a streaming sequence;is_end=Truesignals the final packet.RPCMethodMetadata: The RPC decorator now detects async generator functions and tags them as streaming methods viaRPCMethod.is_stream.rpc.pyDecorator Validation: Both@rpc_method()and@rate_limit()now raiseTypeErrorimmediately 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=Trueandis_end=True, causing client-sidestream_rpc()iterators to hang indefinitely waiting for an end signal. stream_rpcRate Limit:stream_rpc()now correctly raisesRateLimitErrorlocally whenraise_on_rate_limit=Trueis set, matching the behavior ofsend_rpc().- Port Collision in Tests: Shifted integration test ports to higher ranges (5003-5050) to avoid
OSError: [Errno 10048]on Windows caused by TCPTIME_WAITstate from prior test runs.
v0.5.0
[0.5.0] - 2026-02-11
Changed
- Picows Migration: Replaced
websocketswithpicowsfor 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.sendwas marked asasyncbut 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
[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, orAllto 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
pydanticandmsgpackto 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
[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
requireskeyword argument towebshocket.rpc_methodfor custom access control. register_rpc_methodadded toWebSocketServerfor 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_rpcfunction 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
[0.2.5] - 2025-07-27
Added
max_connectionparameter toWebSocketServerto limit the number of concurrent connections.- Added
RPCErrorCodeEnum to represent RPC Response codes. - Few logging for debugging.
Fixed
- Fixed the
close()function forClientConnectionwhere it doesn't immediately change theconnection_statetoCLOSED - Fixed type hinting for
ClientConnection
Changed
- Serialization method for
Packetdata is switched from base64 tomsgpack(binary) Packetdata is no longer restricted for bytes or string, it can be anything as long it's serializeable withmsgpackRPCResponseis now only consisnt ofcall_id(String),response(Any), anderror(RPCErrorCode)
v0.2.0
[0.2.0] - 2025-07-09
Added
- RPC Rate Limiting: Introduced a
@rate_limitdecorator 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
bytespayloads. 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
-
Added: RPC (Remote Procedure Call) Support
- Added
@rpc_methodto easily make your handler methods callable. - New
send_rpcmethod on the client to kick off remote calls. client.recvnow automatically grabs RPC results/errors for you.Packets can now carry RPC stuff.
- Added
-
Fixed: Type Stuff and Imports
- Cleaned up some type hints and import issues for the new RPC feature.