Skip to content

3.0.0

Compare
Choose a tag to compare
@trowski trowski released this 10 Sep 03:25
· 2 commits to 3.x since this release
v3.0.0
8a57456

Stable release compatible with AMPHP v3 and fibers! 🎉

This release is compatible with amphp/http-server@^3 and amphp/websocket@^2.

As with other libraries compatible with AMPHP v3, most cases of parameters or returns of Promise<ResolutionType> have been replaced with ResolutionType.

Similar to v2, a Websocket is created by creating an instance of Websocket and using it as a request handler on an HTTP server. However, the constructor arguments have changed to reflect the changes below and the removal of the Options object from amphp/websocket.

A gateway object is no longer provided automatically to a client handler. A client handler may create one or more WebsocketClientGateway objects to hold a collection of clients and asynchronously broadcast messages to all (or only some) clients within a gateway.

  • 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, ClientHandler is now WebsocketClientHandler, ClientFactory is now WebsocketClientFactory.
  • The handshake accepting functionality of ClientHandler has been split into a separate interface, WebsocketAcceptor. In general, most applications will want to use AllowOriginAcceptor. For more flexibility, create your own implementation by delegating to Rfc6455Acceptor and adding your own logic in handleHandshake().
  • WebsocketServerObserver has been removed. Use the onStart() and onStop() methods of HttpServer if an action is needed when starting or stopping the HTTP server.