Skip to content

2.0.0

Compare
Choose a tag to compare
@trowski trowski released this 10 Sep 02:56
· 11 commits to 2.x since this release
v2.0.0
227e285

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 Websocket as a prefix to avoid name collisions with similarly named classes in other packages which are frequently used together. For example, Client is now WebsocketClient, Message is now WebsocketMessage.
  • WebsocketMessage (formerly Message) now implements Stringable, 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 WebsocketException as base class for WebsocketClosedException as well as a new exception, WebsocketParserException.
  • The Options object has been removed. Various configurations options previously available in this class can now be specified by constructor arguments to various factories, such as Rfc6455ParserFactory in this library or the client factories found in amphp/websocket-server and amphp/websocket-client.
  • Move compression related classes into a Compression sub-namespace.
  • Split the parser and frame compiler from the client implementation, now found in the Parser sub-namespace. This change will allow for greater visibility and logging of activity on a websocket connection.
  • Added WebsocketHeartbeatQueue and WebsocketRateLimit interfaces with implementations PeriodicHeartbeatQueue and ConstantRateLimit. These interfaces and implementations offer greater extensibility and fine-tuning of connection behavior, while maintaining easy setup for most applications.
  • ClientMetadata has been removed in favor of WebsocketCount and WebsocketTimestamp enums coupled with methods on a WebsocketClient, getCount() and getTimestamp(), to query for connection info.
  • The callback provided to WebsocketClient::onClose() is now invoked with two arguments – the Websocket client ID and an instance of WebsocketCloseInfo providing the close code, reason, time, and whom initiated the close.