- socketioxide-core
- engineioxide-core
- parser-common
- parser-msgpack
- socketioxide-redis
- socketioxide-mongodb
- socketioxide
- engineioxide
- fix: issue #527. Socketioxide failed to build with the
tracingflag enable and withtracing-attributesset tov0.1.28.
- deps: remove smallvec deps
- doc: fix some links
- fix: issue #390. First ping was sent twice because of tokio interval behavior defaulting to bursting when interval tick is missed.
- (Breaking): New parsing system. You can now serialize and deserialize binary data inside your own types. It also improve performances by avoiding unnecessary allocations.
- fix: missing extractor error logs for async message handlers.
- feat: add custom compiler error for unimplemented handler traits.
- deps: switch from
towertotower-serviceandtower-layersubcrates. - deps: bump
tokioto 1.40. - deps: bump
httpto 1.1. - deps: bump
hyperto 1.5.
- (Breaking): State reworked to avoid having unsafe global mutable state (issue #317). Therefore State types must now implement
Cloneand will be cloned for each handler where the state is used. - (Breaking): Extensions reworked to avoid
Send+Syncrequirements on extensions (issue #295). They are now extracted byCloning. Therefore all the type must implementClone. AnExtensionextractor is available to get an extension directly without callingsocket.extensions.get(). - feat: New
HttpExtensiontypes to extract extensions from the http request. - feat:
SocketIocan now be used as an extractor. So you can now easily access the entire socket.io context from your handlers. - feat: Dynamic namespaces. You can know set dynamic namespaces with the
dyn_nsfunction. You can specify patterns with the{name}syntax thanks to the matchit crate. The dynamic namespace will create a child namespace for any path that matches the given pattern with the given handler.
- deps: bump
tokio-tungstenitefrom0.21.0to0.23.0.
- fix: issue #320. Remove unnecessary panic when receiving unexpected websocket messages. This might happen with some specific socket.io clients.
- fix: issue #311, the
delete_nsfn was deadlocking the entire server when called from inside adisconnect_handler. - feat: the
delete_nsis now gracefully closing the adapter as well as all its sockets before being removed. - feat: the API use
Bytesrather thanVec<u8>to represent binary payloads. This allow to avoid unnecessary copies. - deps: use
futures-utilandfutures-corerather than the wholefuturescrate.
- feat: the API use
Bytes/Strrather thanVec<u8>andStringto represent payloads. This allow to avoid unnecessary copies. - deps: use
futures-utilandfutures-corerather than the wholefuturescrate.
MSRV: Minimum supported Rust version is now 1.75.
- (Breaking): Introduction of connect middlewares. It allows to execute code before the connection to the namespace is established. It is useful to check the request, to authenticate the user, to log the connection etc. It is possible to add multiple middlewares and to chain them.
- The
SocketRefextractor is nowClone. Be careful to drop clones when the socket is disconnected to avoid any memory leak.
- fix(#232): under heavy traffic, the adjacent binary packet to the head packet requirement for engine.io was not respected. It was leading to a protocol error.
- fix: a panic was raised sometimes under heavy traffic with socketio v5 when the connect timeout handler is destroyed but that the chan sender is still alive.
- (Breaking): Emit errors now contains the provided data if there is an issue with the internal channel (for example if it is full) or if the socket closed.
- (Breaking): Operators are now splitted between
OperatorsandBroadcastOperatorsin order to split logic and fn signatures between broadcast and non-broadcast operators.
- fix #277: with engine.io v3, the message byte prefix
0x4was not added to the binary payload withwstransport. - bump dependency
base64to 0.22.0.
- New
roomsfn to get all the rooms of a namespace.
- New
as_strfn forSid. - Http request is now cloned for the websocket transport (it was not possible before http v1). Therefore it is possible to get headers/extensions of the initial request.
- Rework for
emit_with_ackfns. It now returns anAckStreamthat can be used either as a future when expecting one ack or as a stream when expecting multiple acks. When expecting multiple acks theAckStreamwill yieldAckResults as well as their corresponding socketid.
- Add
SocketIo::get_socketandOperators::get_socketmethods to get a socket ref from its id. - Switch to
pin-project-liteinstead ofpin-project.
- Bump
hyperto 1.0.1. Therefore it is now possible to use frameworks based on hyper v1.*. Check the compatibility table for more details.
- Add
transport_typeandprotocolfn on theSocketstruct. It allows to know the transport type and the protocol used by the socket. - Dynamic
DisconnectHandler. Now theon_disconnecthandler take a dynamic handler that maybe async and contain any type that implementsFromDisconnectParts. It allows to extract data from the disconnection, like the socket, the reason of the disconnection, the state etc. - New
statefeature flag. It enables global state management. It is useful to share data between handlers. It is disabled by default.
- Packet encoding/decoding optimizations.
- Fix #189. Async message handlers were never called because the returned future was not spawned with
tokio::spawn.
- The
on_disconnectcallback now takes aSocketRefrather than anArc<Socket>to match other handlers. It also avoids that the user clone the socket and create a memory leak. - Documentation improvements (see https://docs.rs/socketioxide).
- Bump library dependencies (see release notes).
- Fix #154, build was broken when using the
hyper-v1feature flag because ofhyper-utildependency which is not published on crates.io.
- The
extensionsfield on sockets has been moved to a separate optional feature flag namedextensions - All the
tracinginternal calls have been moved to a separate optional feature flag namedtracing - A compatibility layer is now available for hyper v1 under the feature flag
hyper-v1. You can callwith_hyper_v1on theSocketIoLayeror theSocketIoServiceto get a layer/service working with hyper v1. Therefore, it is now possible to usesalvoas an http server. The default is still hyper v0. - Socket.io packet encoding/decoding has been optimized, it is now between ~15% and ~50% faster than before.
- The v5 feature flag is removed, it is now enabled by default. It is made to avoid destructive feature flags, and to be sure that
--no-default-featureswill always work without enabling anything else. - All the handlers now have dynamic parameters. It is now possible to use any type that implements
FromMessagePartsorFromMessageas a parameter for a message handler andFromConnectPartfor a connect handler. This is useful to extract data from the event, like the socket, the data, an acknowledgment, etc. - All the handlers are now optionally async.
- The request data to initialize the socket.io connection is available with
Socket::req_parts(). - MSRV is now 1.67.0
- Bump tokio from 1.33.0 to 1.34.0
- Bump serde from 1.0.190 to 1.0.192
- Bump serde_json from 1.0.107 to 1.0.108
- All the
tracinginternal calls have been moved to a separate optional feature flag namedtracing - A compatibility layer is now available for hyper v1 under the feature flag
hyper-v1. You can callwith_hyper_v1on theEngineIoLayeror theEngineIoServiceto get a layer/service working with hyper v1. The default is still hyper v0. - Sid generation is now done manually without external crates
- The v4 feature flag is removed, it is now enabled by default. It is made to avoid destructive feature flags, and to be sure that
--no-default-featureswill always work without enabling anything else. - Fix an upgrade synchronization bug when using the websocket transport which was leading the client to wait for a ping packet (30s by default) before upgrading to websocket.
- The
on_connecthandler was called twice when upgrading to websocket. It is now called only once.
- New API for creating the socket.io layer/service. A cheaply clonable
SocketIostruct is now returned with the layer/service and allows to access namespaces/rooms/sockets everywhere in the application. Moreover, it is now possible to add and remove namespaces dynamically through theSocketIostruct. - The socket.io v4 protocol is now available under the feature flag
v4, it matches every socket.io js version from 1.0.3 to current . Thev5protocol is still the default and is more performant, it matches every socket.io js version from v3.0.0 to current.
- The socket parameter for the handler is now an
Arc<Socket>. - The
max_payloadoption is now applied when encoding a packet. Before, it was only applied when decoding a packet. - With
websockettransport, packets are now bufferred before being flushed. Before, they were flushed one by one.
- Fix a data race bug causing a protocol error when upgrading. A Noop engine.io packet was sent trough the websocket connection after an upgrade. Now all noop packets passing trough the websocket transport are filtered out.
- Fix a bug with binary packets with namespaces : namespace was put before the payload count whereas it should be put after according to the payload datagram.
- A
on_disconnectfunction is now available on theSocketinstance. The provided callback will be called when the socket disconnects with the reasons for the disconnection. This is useful for logging or cleanup data. - A
connect_timeoutoption is now available in the config options. It is the maximum time to wait for a socket.io handshake before closing the connection. The default is 45 seconds. - A
NsHandlersstruct was added. It describes namespace handlers passed to the SocketIoLayer/SocketIoService. Before, it was a type alias for a HashMap and it was containing types that were not supposed to be public.
- A
DisconnectReasonenum is passed to theon_disconnectcallback of the engine handler. - Bump
tokio-tungsteniteto 0.20.1.