diff --git a/.github/workflows/maven.yml b/.github/workflows/maven.yml
index 1b16fbc..4171439 100644
--- a/.github/workflows/maven.yml
+++ b/.github/workflows/maven.yml
@@ -16,7 +16,7 @@ jobs:
steps:
- uses: actions/checkout@v2
- - uses: browser-actions/setup-firefox@v1
+ - uses: browser-actions/setup-chrome@v1
- name: Set up JDK 21
uses: actions/setup-java@v1
diff --git a/main-app/main-webapp/pom.xml b/main-app/main-webapp/pom.xml
index 4aaa13c..d96853b 100644
--- a/main-app/main-webapp/pom.xml
+++ b/main-app/main-webapp/pom.xml
@@ -165,14 +165,6 @@
org.webjars
bootstrap
-
- org.webjars
- sockjs-client
-
-
- org.webjars
- stomp-websocket
-
org.webjars.bower
jquery-toast-plugin
diff --git a/main-app/main-webapp/src/main/java/gt/app/config/WebSocketConfig.java b/main-app/main-webapp/src/main/java/gt/app/config/WebSocketConfig.java
index 471ada7..85cfe11 100644
--- a/main-app/main-webapp/src/main/java/gt/app/config/WebSocketConfig.java
+++ b/main-app/main-webapp/src/main/java/gt/app/config/WebSocketConfig.java
@@ -19,9 +19,7 @@ public void configureMessageBroker(MessageBrokerRegistry config) {
@Override
public void registerStompEndpoints(StompEndpointRegistry registry) {
- registry.addEndpoint("/app-websockets-main-endpoint")
- .setAllowedOrigins("http://localhost:8081") //TODO: fix this before prod release
- .withSockJS();
+ registry.addEndpoint("/app-websockets-main-endpoint");
}
}
diff --git a/main-app/main-webapp/src/main/resources/static/js/app.js b/main-app/main-webapp/src/main/resources/static/js/app.js
index e25fee3..a688711 100644
--- a/main-app/main-webapp/src/main/resources/static/js/app.js
+++ b/main-app/main-webapp/src/main/resources/static/js/app.js
@@ -27,17 +27,30 @@
displayUserInfo(ev);
});
- initSockJS();
+ initStompJs();
});
- function initSockJS() {
+ function initStompJs() {
//TODO: implement auto reconnect on disconnect
- var socket = new SockJS('/app-websockets-main-endpoint');
- stompClient = Stomp.over(socket);
- stompClient.connect({}, function (frame) {
+
+ stompClient = new StompJs.Client({
+ brokerURL: 'ws://localhost:8081/app-websockets-main-endpoint',
+ connectHeaders: {
+ login: 'user',
+ passcode: 'password',
+ },
+ debug: function (str) {
+ console.log(str);
+ },
+ reconnectDelay: 5000,
+ heartbeatIncoming: 4000,
+ heartbeatOutgoing: 4000,
+ });
+
+ stompClient.onConnect = function(frame){
console.log('Connected: ' + frame);
stompClient.subscribe('/topic/global-messages', function (msg) {
@@ -62,6 +75,17 @@
position: 'top-right',
});
});
- });
+ }
+
+ stompClient.onStompError = function (frame) {
+ // Will be invoked in case of error encountered at Broker
+ // Bad login/passcode typically will cause an error
+ // Complaint brokers will set `message` header with a brief message. Body may contain details.
+ // Compliant brokers will terminate the connection after any error
+ console.log('Broker reported error: ' + frame.headers['message']);
+ console.log('Additional details: ' + frame.body);
+ };
+
+ stompClient.activate();
}
})();
diff --git a/main-app/main-webapp/src/main/resources/templates/_fragments/footer.html b/main-app/main-webapp/src/main/resources/templates/_fragments/footer.html
index 5da7f81..efc8248 100644
--- a/main-app/main-webapp/src/main/resources/templates/_fragments/footer.html
+++ b/main-app/main-webapp/src/main/resources/templates/_fragments/footer.html
@@ -20,7 +20,6 @@
-
diff --git a/main-app/main-webapp/src/test/java/gt/app/e2e/PublicPageIT.java b/main-app/main-webapp/src/test/java/gt/app/e2e/PublicPageIT.java
index f93da4e..a2a7432 100644
--- a/main-app/main-webapp/src/test/java/gt/app/e2e/PublicPageIT.java
+++ b/main-app/main-webapp/src/test/java/gt/app/e2e/PublicPageIT.java
@@ -43,7 +43,7 @@ void loadIndexPageAndVerifyResultIsCached(@Autowired MockMvc mvc) throws Excepti
.andReturn();
String content = result.getResponse().getContentAsString();
- assertTrue(content.contains(" Article App - HOME"));
+ assertTrue(content.contains("Article App - HOME"));
assertTrue(content.contains("User2 Article"));
assertTrue(content.contains("Ganesh Tiwari"));
@@ -68,7 +68,7 @@ void testCacheAndDBBothAreResetBetweenTests(@Autowired MockMvc mvc) throws Excep
.andReturn();
String content = result.getResponse().getContentAsString();
- assertTrue(content.contains(" Article App - HOME"));
+ assertTrue(content.contains("Article App - HOME"));
assertTrue(content.contains("User2 Article"));
assertTrue(content.contains("Ganesh Tiwari"));
diff --git a/pom.xml b/pom.xml
index 25b5a36..8a00736 100644
--- a/pom.xml
+++ b/pom.xml
@@ -51,8 +51,6 @@
2.14.0
3.6.1
5.0.1
- 1.5.1
- 2.3.4
1.3.2
2.4-M1-groovy-4.0
@@ -206,16 +204,6 @@
bootstrap
${webjar-bootstrap.version}
-
- org.webjars
- sockjs-client
- ${webjar-sockjs-client.version}
-
-
- org.webjars
- stomp-websocket
- ${webjar-stomp-websocket.version}
-
org.webjars.bower
jquery-toast-plugin