You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Both the server and client APIs allow you to define _endpoints_ that are used to consume and send messages.
81
+
Both the <<server-api>> and <<client-api>> define _endpoints_ that are used to consume and send messages.
82
82
The endpoints are implemented as CDI beans and support injection.
83
83
Endpoints declare <<callback-methods,_callback methods_>> annotated with `@OnTextMessage`, `@OnBinaryMessage`, `@OnPong`, `@OnOpen`, `@OnClose` and `@OnError`.
84
84
These methods are used to handle various WebSocket events.
@@ -559,6 +559,7 @@ This means that if an endpoint receives events `A` and `B` (in this particular o
559
559
However, in some situations it is preferable to process events concurrently, i.e. with no ordering guarantees but also with no concurrency limits.
560
560
For this cases, the `InboundProcessingMode#CONCURRENT` should be used.
561
561
562
+
[[server-api]]
562
563
== Server API
563
564
564
565
=== HTTP server configuration
@@ -900,14 +901,15 @@ public class CustomTenantResolver implements TenantResolver {
900
901
----
901
902
For more information on Hibernate multitenancy, refer to the https://quarkus.io/guides/hibernate-orm#multitenancy[hibernate documentation].
902
903
904
+
[[client-api]]
903
905
== Client API
904
906
905
907
[[client-connectors]]
906
908
=== Client connectors
907
909
908
-
The `io.quarkus.websockets.next.WebSocketConnector<CLIENT>` is used to configure and create new connections for client endpoints.
909
-
A CDI bean that implements this interface is provided and can be injected in other beans.
910
-
The actual type argument is used to determine the client endpoint.
910
+
A connector can be used to configure and open a new client connection backed by a client endpoint that is used to consume and send messages.
911
+
Quarkus provides a CDI bean with bean type `io.quarkus.websockets.next.WebSocketConnector<CLIENT>` and default qualifer that can be injected in other beans.
912
+
The actual type argument of an injection point is used to determine the client endpoint.
911
913
The type is validated during build - if it does not represent a client endpoint the build fails.
912
914
913
915
Let’s consider the following client endpoint:
@@ -955,6 +957,31 @@ public class MyBean {
955
957
956
958
NOTE: If an application attempts to inject a connector for a missing endpoint, an error is thrown.
957
959
960
+
Connectors are not thread-safe and should not be used concurrently.
961
+
Connectors should also not be reused.
962
+
If you need to create multiple connections in a row you'll need to obtain a new connetor instance programmatically using `Instance#get()`:
0 commit comments