Skip to content

Commit abb169b

Browse files
authored
Merge pull request #5 from SEPIA-Framework/dev
Update to 2.1.0 - adjustments to core tools update - improved errorMessage handler
2 parents 505b87e + bc912e1 commit abb169b

File tree

6 files changed

+15
-7
lines changed

6 files changed

+15
-7
lines changed

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@
8080
<dependency>
8181
<groupId>net.b07z.sepia.server.core</groupId>
8282
<artifactId>sepia-core-tools</artifactId>
83-
<version>2.0.1</version>
83+
<version>2.1.0</version>
8484
</dependency>
8585
<dependency>
8686
<groupId>com.j2html</groupId>

src/main/java/net/b07z/sepia/websockets/client/SocketClientHandler.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package net.b07z.sepia.websockets.client;
22
import java.net.URI;
33

4+
import org.eclipse.jetty.client.HttpClient;
45
import org.eclipse.jetty.util.ssl.SslContextFactory;
56
import org.eclipse.jetty.websocket.client.ClientUpgradeRequest;
67
import org.eclipse.jetty.websocket.client.WebSocketClient;
@@ -41,8 +42,9 @@ public SocketClientHandler(SocketClient socket){
4142
if (SocketConfig.isSSL){
4243
SslContextFactory sslContextFactory = new SslContextFactory();
4344
sslContextFactory.setKeyStorePath("Xtensions/SSL/ssl-keystore.jks");
44-
sslContextFactory.setKeyStorePassword(SocketConfig.keystorePwd);
45-
client = new WebSocketClient(sslContextFactory);
45+
sslContextFactory.setKeyStorePassword(SocketConfig.keystorePwd);
46+
client = new WebSocketClient(new HttpClient(sslContextFactory));
47+
//replaced for sparkjava: client = new WebSocketClient(sslContextFactory);
4648
}else{
4749
client = new WebSocketClient();
4850
}

src/main/java/net/b07z/sepia/websockets/common/SocketConfig.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ public class SocketConfig {
2020
public static final String SERVERNAME = "SEPIA-Websocket-Server"; //this is to identify the server (in client as well)
2121
public static String localName = "sepia-websocket-server"; //**user defined local server name
2222
public static String localSecret = "123456"; //**user defined secret to validate local server
23-
public static final String apiVersion = "v2.0.0";
23+
public static final String apiVersion = "v1.1.0";
2424
public static String privacyPolicyLink = ""; //Link to privacy policy
2525

2626
public static final boolean allowCORS = true;

src/main/java/net/b07z/sepia/websockets/common/SocketMessage.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ public static enum DataType{
3535
assistAnswer, //has data for assistant communication
3636
directCmd, //has a direct cmd for assistant
3737
remoteAction, //has a remote action like ASR trigger or hotkey submit
38-
errorMessage //tbd
38+
errorMessage //combined with TextType.status this message will be displayed as error line in channel (ignores normal status msg settings)
3939
}
4040
public static enum SenderType{
4141
user,

src/main/java/net/b07z/sepia/websockets/server/SepiaSocketHandler.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -208,6 +208,12 @@ public void onMessage(Session userSession, String message) {
208208
){
209209
preBroadcastAction(user, msg, false, false, false);
210210
broadcastMessage(msg);
211+
212+
//error broadcast
213+
}else if (dataType.equals(DataType.errorMessage.name())){
214+
msg.textType = TextType.status.name(); //force status text
215+
preBroadcastAction(user, msg, false, false, false);
216+
broadcastMessage(msg);
211217

212218
//broadcast default welcome and byebye
213219
/* -- has been disabled, for now only server is allowed to send it --

src/main/java/net/b07z/sepia/websockets/server/StartWebSocketServer.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -135,10 +135,10 @@ public static void main(String[] args) {
135135
SocketServer server = new SepiaSocketHandler();
136136
AbstractSocketHandler.server = server;
137137

138-
webSocket("/messages", AbstractSocketHandler.class);
138+
webSocket("/messages/", AbstractSocketHandler.class); //NOTE: it HAS TO end with "/"
139139
webSocketIdleTimeoutMillis(SocketConfig.IDLE_TIMEOUT);
140-
141140
//init(); //only needed when no REST end-points follow
141+
142142
get("/online", (request, response) -> CoreEndpoints.onlineCheck(request, response));
143143
get("/ping", (request, response) -> CoreEndpoints.ping(request, response, SocketConfig.SERVERNAME));
144144
get("/validate", (request, response) -> CoreEndpoints.validateServer(request, response, SocketConfig.SERVERNAME,

0 commit comments

Comments
 (0)