File tree Expand file tree Collapse file tree 7 files changed +34
-33
lines changed Expand file tree Collapse file tree 7 files changed +34
-33
lines changed Original file line number Diff line number Diff line change 1616
1717 steps :
1818 - uses : actions/checkout@v2
19- - uses : browser-actions/setup-firefox @v1
19+ - uses : browser-actions/setup-chrome @v1
2020
2121 - name : Set up JDK 21
2222 uses : actions/setup-java@v1
Original file line number Diff line number Diff line change 165165 <groupId >org.webjars</groupId >
166166 <artifactId >bootstrap</artifactId >
167167 </dependency >
168- <dependency >
169- <groupId >org.webjars</groupId >
170- <artifactId >sockjs-client</artifactId >
171- </dependency >
172- <dependency >
173- <groupId >org.webjars</groupId >
174- <artifactId >stomp-websocket</artifactId >
175- </dependency >
176168 <dependency >
177169 <groupId >org.webjars.bower</groupId >
178170 <artifactId >jquery-toast-plugin</artifactId >
Original file line number Diff line number Diff line change @@ -19,9 +19,7 @@ public void configureMessageBroker(MessageBrokerRegistry config) {
1919
2020 @ Override
2121 public void registerStompEndpoints (StompEndpointRegistry registry ) {
22- registry .addEndpoint ("/app-websockets-main-endpoint" )
23- .setAllowedOrigins ("http://localhost:8081" ) //TODO: fix this before prod release
24- .withSockJS ();
22+ registry .addEndpoint ("/app-websockets-main-endpoint" );
2523 }
2624
2725}
Original file line number Diff line number Diff line change 2727 displayUserInfo ( ev ) ;
2828 } ) ;
2929
30- initSockJS ( ) ;
30+ initStompJs ( ) ;
3131 } ) ;
3232
3333
34- function initSockJS ( ) {
34+ function initStompJs ( ) {
3535
3636 //TODO: implement auto reconnect on disconnect
3737
38- var socket = new SockJS ( '/app-websockets-main-endpoint' ) ;
39- stompClient = Stomp . over ( socket ) ;
40- stompClient . connect ( { } , function ( frame ) {
38+
39+ stompClient = new StompJs . Client ( {
40+ brokerURL : 'ws://localhost:8081/app-websockets-main-endpoint' ,
41+ connectHeaders : {
42+ login : 'user' ,
43+ passcode : 'password' ,
44+ } ,
45+ debug : function ( str ) {
46+ console . log ( str ) ;
47+ } ,
48+ reconnectDelay : 5000 ,
49+ heartbeatIncoming : 4000 ,
50+ heartbeatOutgoing : 4000 ,
51+ } ) ;
52+
53+ stompClient . onConnect = function ( frame ) {
4154
4255 console . log ( 'Connected: ' + frame ) ;
4356 stompClient . subscribe ( '/topic/global-messages' , function ( msg ) {
6275 position : 'top-right' ,
6376 } ) ;
6477 } ) ;
65- } ) ;
78+ }
79+
80+ stompClient . onStompError = function ( frame ) {
81+ // Will be invoked in case of error encountered at Broker
82+ // Bad login/passcode typically will cause an error
83+ // Complaint brokers will set `message` header with a brief message. Body may contain details.
84+ // Compliant brokers will terminate the connection after any error
85+ console . log ( 'Broker reported error: ' + frame . headers [ 'message' ] ) ;
86+ console . log ( 'Additional details: ' + frame . body ) ;
87+ } ;
88+
89+ stompClient . activate ( ) ;
6690 }
6791} ) ( ) ;
Original file line number Diff line number Diff line change 2020 < script src ="/webjars/jquery/3.6.1/jquery.min.js "> </ script >
2121 < script src ="/webjars/bootstrap/5.0.1/js/bootstrap.min.js "> </ script >
2222
23- < script src ="https://cdn.jsdelivr.net/npm/sockjs-client@1/dist/sockjs.min.js "> </ script >
2423 < script src ="https://cdn.jsdelivr.net/npm/@stomp/stompjs@7.0.0/bundles/stomp.umd.min.js "> </ script >
2524 < script src ="/webjars/jquery-toast-plugin/1.3.2/dist/jquery.toast.min.js "> </ script >
2625 < script th:src ="@{/static/js/wro-commons.js} "> </ script >
Original file line number Diff line number Diff line change @@ -43,7 +43,7 @@ void loadIndexPageAndVerifyResultIsCached(@Autowired MockMvc mvc) throws Excepti
4343 .andReturn ();
4444
4545 String content = result .getResponse ().getContentAsString ();
46- assertTrue (content .contains ("<title> Article App - HOME</title>" ));
46+ assertTrue (content .contains ("<title>Article App - HOME</title>" ));
4747 assertTrue (content .contains ("User2 Article" ));
4848 assertTrue (content .contains ("Ganesh Tiwari" ));
4949
@@ -68,7 +68,7 @@ void testCacheAndDBBothAreResetBetweenTests(@Autowired MockMvc mvc) throws Excep
6868 .andReturn ();
6969
7070 String content = result .getResponse ().getContentAsString ();
71- assertTrue (content .contains ("<title> Article App - HOME</title>" ));
71+ assertTrue (content .contains ("<title>Article App - HOME</title>" ));
7272 assertTrue (content .contains ("User2 Article" ));
7373 assertTrue (content .contains ("Ganesh Tiwari" ));
7474
Original file line number Diff line number Diff line change 5151 <commons-io .version>2.14.0</commons-io .version>
5252 <webjar-jquery .version>3.6.1</webjar-jquery .version>
5353 <webjar-bootstrap .version>5.0.1</webjar-bootstrap .version>
54- <webjar-sockjs-client .version>1.5.1</webjar-sockjs-client .version>
55- <webjar-stomp-websocket .version>2.3.4</webjar-stomp-websocket .version>
5654 <webjar-jquery-toast-plugin .version>1.3.2</webjar-jquery-toast-plugin .version>
5755
5856 <spock-version >2.4-M1-groovy-4.0</spock-version >
206204 <artifactId >bootstrap</artifactId >
207205 <version >${webjar-bootstrap.version} </version >
208206 </dependency >
209- <dependency >
210- <groupId >org.webjars</groupId >
211- <artifactId >sockjs-client</artifactId >
212- <version >${webjar-sockjs-client.version} </version >
213- </dependency >
214- <dependency >
215- <groupId >org.webjars</groupId >
216- <artifactId >stomp-websocket</artifactId >
217- <version >${webjar-stomp-websocket.version} </version >
218- </dependency >
219207 <dependency >
220208 <groupId >org.webjars.bower</groupId >
221209 <artifactId >jquery-toast-plugin</artifactId >
You can’t perform that action at this time.
0 commit comments