- Added autoconfiguration support
Gos\Bundle\WebSocketBundle\Periodic\PeriodicInterface(gos_web_socket.periodictag)Gos\Bundle\WebSocketBundle\RPC\RpcInterface(gos_web_socket.rpctag)Gos\Bundle\WebSocketBundle\Server\Type\ServerInterface(gos_web_socket.servertag)Gos\Bundle\WebSocketBundle\Topic\TopicInterface(gos_web_socket.topictag)
- Added
Gos\Bundle\WebSocketBundle\Client\ClientManipulatorInterface::findAllByUsername()- Unlike
Gos\Bundle\WebSocketBundle\Client\ClientManipulatorInterface::findByUsername()which only returns the first match, the new method returns all matching connections for a username
- Unlike
- Added new
gos_web_socket.ping.servicesconfiguration node to configure pingable periodic services, presently supporting a Doctrine Connection or PDO- This is an array node where each value requires two keys:
name(the container service ID) andtype(the service type, either "doctrine" or "pdo")
- This is an array node where each value requires two keys:
- Added support for env vars on all "host" and "port" config nodes
Example configuration of the ping services:
gos_web_socket:
ping:
services:
-
name: 'database_connection' # alias for the default database connection created by the DoctrineBundle
type: 'doctrine'
-
name: 'pdo' # a custom service in your application that is a PDO connection
type: 'pdo'
- Renamed the
gos_web_socket_client.jsfile towebsocket.js, in addition the bundle now provides a minified version of this file and a ES2015+ source file - Enabled
declare(strict_types=1);in all bundle files - Added typehints and return types to most classes and interfaces
- Most classes are now final, use decorators or direct implement interfaces to implement custom behaviors
- The dependency to
gos/pubsub-router-bundlehas been raised to^1.0, this will require updates to your router resources - This bundle will now always cause the
gos_pubsub_router.router.websocketservice to be generated by theGosPubSubRouterBundle Gos\Bundle\WebSocketBundle\Router\WampRouterhas been modified to account for the updatedGosPubSubRouterBundle:- The
getContextandsetContextmethods have been removed - The
$tokenSeparatorargument of thegenerateandmatchmethods has been removed
- The
- Moved all event listener classes to the
Gos\Bundle\WebSocketBundle\EventListenernamespace - The
Gos\Bundle\WebSocketBundle\Event\Eventsclass is deprecated, theGos\Bundle\WebSocketBundle\GosWebSocketEventsclass should be used instead - The
Gos\Bundle\WebSocketBundle\Event\ServerEventnow requires a third argument,$profile, indicating if profiling is enabled (i.e. the--profileoption from thegos:websocket:servercommand) Gos\Bundle\WebSocketBundle\Pusher\PusherInterfacenow includes asetName()methodGos\Bundle\WebSocketBundle\Pusher\PusherRegistry::addPusher()andGos\Bundle\WebSocketBundle\Pusher\ServerPushHandlerRegistry::addPushHandler()no longer have a separate$nameargument, the name from the injected object is used insteadGos\Bundle\WebSocketBundle\Client\ClientManipulatorInterfacehas had several changes:- The
getClient()method now returns aSymfony\Component\Security\Core\Authentication\Token\TokenInterfaceobject and the return is typehinted (public function getClient(ConnectionInterface $connection): TokenInterface) - Added a
getUser()method which is fundamentally similar to the behavior ofgetClient()in 1.x, essentially this is a shortcut for$manipulator->getClient()->getUser(); - Because of the change to
getClient(), the return types offindByUsername(),findByRoles(), andgetAll()have changed toTokenInterfaceobjects findByRoles()andgetAll()will now return an empty array when no matching objects are found instead of boolean false
- The
Gos\Bundle\WebSocketBundle\Client\ClientStorageInterfacehas had the following changes:- The
getClient()method now returns aSymfony\Component\Security\Core\Authentication\Token\TokenInterfaceobject and the return is typehinted (public function getClient(ConnectionInterface $connection): TokenInterface) - The second argument of
addClient()is now required to be aTokenInterfaceobject findByRoles()andgetAll()will now return an empty array when no matching objects are found instead of boolean false
- The
- All bundle services have been explicitly marked public or private
- Registering periodic timers and push handlers in the default websocket server (
Gos\Bundle\WebSocketBundle\Server\Type\WebSocketServer) has been extracted to event listeners subscribed to thegos_web_socket.server_launchedevent - Connection related dependencies are now managed by connection factories for the pushers and server push handlers
- The
getConfig()andsetConfig()methods ofGos\Bundle\WebSocketBundle\Pusher\PusherInterfaceandGos\Bundle\WebSocketBundle\Pusher\ServerPushHandlerInterfacehave been removed, as well as the logic in the compiler passes for injecting the configuration from the bundle's services - The
findByUsername()method ofGos\Bundle\WebSocketBundle\Client\ClientManipulatorInterfaceis deprecated and will be removed in 3.0, thefindAllByUsername()method should be used instead. - The
clientStorageIdproperty of a connection is no longer set (i.e.$connection->WAMP->clientStorageId), if you need this you should get it from theClientStorageInterface(i.e.$clientStorage->getStorageId($connection)) - The router and serializer dependencies of
Gos\Bundle\WebSocketBundle\Pusher\AbstractPusherand its subclasses are now injected through the constructors - The first argument of
Gos\Bundle\WebSocketBundle\Pusher\AbstractPusher::doPush()is now aGos\Bundle\WebSocketBundle\Pusher\Messageobject instead of a serialized message, subclasses should handle serialization on their own if needed - The second argument of
Gos\Bundle\WebSocketBundle\Pusher\ServerPushHandlerInterface::handle()is now typehinted as aGos\Bundle\WebSocketBundle\Server\App\PushableWampServerInterfaceobject - Server pushers and push handlers now use the
@serializerservice to serialize and deserialize messages instead of a separateSymfony\Component\Serializer\Serializerinstance - Renamed a number of bundle services to use a consistent naming convention and deprecated the previous service IDs, please review the
Resources/config/services/deprecated_aliases.ymlfile for a list of changes - The container parameters set by the bundle have been renamed for consistency and to use the bundle's prefix:
web_socket_server.client_storage.ttlis nowgos_web_socket.client.storage.ttlweb_socket_server.client_storage.prefixis nowgos_web_socket.client.storage.prefixweb_socket_server.portis nowgos_web_socket.server.portweb_socket_origin_checkis nowgos_web_socket.server.origin_checkweb_socket_keepalive_pingis nowgos_web_socket.server.keepalive_pingweb_socket_keepalive_intervalis nowgos_web_socket.server.keepalive_interval
Each pusher configuration node now has an enabled option, this must be set to true to enable a pusher; for example:
gos_web_socket:
pushers:
wamp:
enabled: true
host: '127.0.0.1'
port: 1337- The minimum supported Symfony version is now 3.4
- Removed support for the AsseticBundle as it itself is deprecated
- The
client.html.twigfile, which loaded assets with Assetic was removed as a result - The
ws_client()Twig function, which rendered the above file, was also removed - The
gos_web_socket.asseticconfiguration node should be removed from your application
- The
- Removed deprecated classes/traits/interfaces
Gos\Bundle\WebSocketBundle\Client\DoctrineCacheDriverDecoratorwas removed, useGos\Bundle\WebSocketBundle\Client\Driver\DoctrineCacheDriverDecoratorinsteadGos\Bundle\WebSocketBundle\Client\WebSocketUserTraitwas removed, inject the@gos_web_socket.client.manipulatorservice instead
- Removed the following configuration nodes, these services should be tagged instead
gos_web_socket.periodic, tag your services with thegos_web_socket.periodictaggos_web_socket.rpc, tag your services with thegos_web_socket.rpctaggos_web_socket.servers, tag your services with thegos_web_socket.servertaggos_web_socket.topics, tag your services with thegos_web_socket.topictag
- Removed the
gos_web_socket.pushers.amqp.defaultconfiguration node, it was unused - The
gos:servercommand was removed, use thegos:websocket:servercommand instead - Removed the
PingableDriverCompilerPasswhich previously configured the PDO ping periodic service - Removed the
gos_web_socket.pdo.periodic_pingservice - Removed the
Gos\Bundle\WebSocketBundle\Router\NullPubSubRouterclass andgos_web_socket.null.pubsub.routerservice - Removed
Gos\Bundle\WebSocketBundle\Pusher\MessageInterface, theGos\Bundle\WebSocketBundle\Pusher\Messageobject should be used instead (this is an internal object for building a message for server pushers) - Removed
Gos\Bundle\WebSocketBundle\Pusher\Serializer\MessageSerializer, aSymfony\Component\Serializer\SerializerInterfaceimplementation should be used instead (generally the@serializerservice) - The
Gos\Bundle\WebSocketBundle\Pusher\Amqp\Utilsclass has been removed- This was an internal helper for building
ext/amqprelated dependencies and should not have been used by package users
- This was an internal helper for building
- Removed the
gos_web_socket.ws.clientservice, aGos\Bundle\WebSocketBundle\Pusher\Wamp\WampConnectionFactoryInterfaceinstance should be used to create the client if needed - Removed support for ZeroMQ as a push service due to the PHP extension being unmaintained