@@ -19,13 +19,13 @@ public WebsocketEndpoints(WebsocketConnection client) {
19
19
20
20
@ Override
21
21
public void onOpen (Session session , EndpointConfig config ) {
22
- client .sessionReady .complete (session );
22
+ client .sessionReady () .complete (session );
23
23
log .info ("Connected to server" );
24
24
25
25
// onOpen-Handler
26
- if (client .onOpenHandler != null ) {
26
+ if (client .onOpenHandler () != null ) {
27
27
try {
28
- client .onOpenHandler .accept (session );
28
+ client .onOpenHandler () .accept (session );
29
29
} catch (Exception e ) {
30
30
log .error ("Error executing onOpen handler: " , e );
31
31
}
@@ -35,9 +35,9 @@ public void onOpen(Session session, EndpointConfig config) {
35
35
session .addMessageHandler (String .class , message -> {
36
36
log .debug ("Received message: " + message );
37
37
client .awaitOpen (Duration .ofMillis (5000L ));
38
- if (client .onMessageHandler != null ) {
38
+ if (client .onMessageHandler () != null ) {
39
39
try {
40
- client .onMessageHandler .accept (message );
40
+ client .onMessageHandler () .accept (message );
41
41
} catch (Exception e ) {
42
42
log .error ("Error executing onMessage handler: " , e );
43
43
}
@@ -49,9 +49,9 @@ public void onOpen(Session session, EndpointConfig config) {
49
49
public void onClose (Session session , CloseReason closeReason ) {
50
50
Session s = client .awaitOpen (Duration .ofMillis (5000L ));
51
51
log .info ("Disconnected from server: {}" , closeReason );
52
- if (client .onCloseHandler != null ) {
52
+ if (client .onCloseHandler () != null ) {
53
53
try {
54
- client .onCloseHandler .accept (s );
54
+ client .onCloseHandler () .accept (s );
55
55
} catch (Exception e ) {
56
56
log .error ("Error executing onClose handler: " , e );
57
57
}
@@ -68,9 +68,9 @@ public void onClose(Session session, CloseReason closeReason) {
68
68
public void onError (Session session , Throwable throwable ) {
69
69
client .awaitOpen (Duration .ofMillis (5000L ));
70
70
log .error ("Error occurred: " , throwable );
71
- if (client .onErrorHandler != null ) {
71
+ if (client .onErrorHandler () != null ) {
72
72
try {
73
- client .onErrorHandler .accept (throwable );
73
+ client .onErrorHandler () .accept (throwable );
74
74
} catch (Exception e ) {
75
75
log .error ("Error executing onError handler: " , e );
76
76
}
0 commit comments