Releases: amphp/websocket
Releases · amphp/websocket
2.0.4
2.0.3
What's Changed
WebsocketExceptionnow extendsAmp\ByteStream\StreamExceptionto avoid violating theReadableStreaminterface by throwing a non-StreamExceptionfrom a stream method.
Full Changelog: v2.0.2...v2.0.3
2.0.2
2.0.1
2.0.0
Stable release compatible with AMPHP v3 and fibers! 🎉
As with other libraries compatible with AMPHP v3, most cases of parameters or returns of Promise<ResolutionType> have been replaced with ResolutionType.
- Renamed most classes and interfaces to add
Websocketas a prefix to avoid name collisions with similarly named classes in other packages which are frequently used together. For example,Clientis nowWebsocketClient,Messageis nowWebsocketMessage. WebsocketMessage(formerlyMessage) now implementsStringable, allowing the object to be simply cast to a string to buffer the contents of a message. Max message limits set on the client will apply.- Added
WebsocketExceptionas base class forWebsocketClosedExceptionas well as a new exception,WebsocketParserException. - The
Optionsobject has been removed. Various configurations options previously available in this class can now be specified by constructor arguments to various factories, such asRfc6455ParserFactoryin this library or the client factories found inamphp/websocket-serverandamphp/websocket-client. - Move compression related classes into a
Compressionsub-namespace. - Split the parser and frame compiler from the client implementation, now found in the
Parsersub-namespace. This change will allow for greater visibility and logging of activity on a websocket connection. - Added
WebsocketHeartbeatQueueandWebsocketRateLimitinterfaces with implementationsPeriodicHeartbeatQueueandConstantRateLimit. These interfaces and implementations offer greater extensibility and fine-tuning of connection behavior, while maintaining easy setup for most applications. ClientMetadatahas been removed in favor ofWebsocketCountandWebsocketTimestampenums coupled with methods on aWebsocketClient,getCount()andgetTimestamp(), to query for connection info.- The callback provided to
WebsocketClient::onClose()is now invoked with two arguments – the Websocket client ID and an instance ofWebsocketCloseInfoproviding the close code, reason, time, and whom initiated the close.
2.0.0 Beta 4
- Added
WebsocketParser,WebsocketParserFactory,Rfc6455Parser, andWebsocketFrameHandler, splitting the frame parser fromRfc6455Client
2.0.0 Beta 3
- Added compatibility with Revolt v1.x
2.0.0 Beta 2
- Fixed a warning being issued if invalid compressed frame data was received
- Fixed issue where a slow consuming client would delay closing the connection
- Moved default value constants from
WebsocketClientinterface toRfc5455Client - Changed
ClientMetadata::$lastHeartbeatAtto be set when the pong frame is received rather than when the ping frame is sent
2.0.0 Beta 1
Initial release compatible with AMPHP v3.
As with other libraries compatible with AMPHP v3, most cases of parameters or returns of Promise<ResolutionType> have been replaced with ResolutionType.
- Removed the
Optionsobject. Settings that were set using properties on theOptionsobject are now parameters to client factories in thewebsocket-clientandwebsocket-serverlibraries or theHeartbeatQueueandRateLimiterinterfaces - Added
HeartbeatQueueandRateLimiterinterfaces with implementationsDefaultHeartbeatQueueandDefaultRateLimiter– these objects replace some of the functionality that was only contained withinRfc6455Clientand controlled viaOptions Opcodeis now anenum- Added
Websocketas a prefix to several classes:Clientrenamed toWebsocketClientClientMetadatarenamed toWebsocketClientMetadataMessagerenamed toWebsocketMessage
WebsocketClientnow extendsAmp\ClosableisConnected()method replaced withisClosed()
WebsocketClient::receive()now supports cancellation. Cancelled receives do not discard a message, a subsequent call toreceive()will still return the next message received from the client- Closures provided to
WebsocketClient::onClose()are provided an instance ofWebsocketClientMetadatainstead of the client object, close code, and reason. The code and reason are available on the metadata object.
1.0.3
- Added
GOING_AWAYto the list of normal close codes, which will causeClient::receive()to return null instead of throwing an exception if a browser sends this code when navigating away from a page - Fixed undefined array access in rare case where the event loop is exited after receiving a message on the websocket and then re-entered at a later time (amphp/websocket-client#39)