Added enums and infrastructure for different types of ws messages

built newest epq-web application bundle to static
This commit is contained in:
Zhongheng Liu 2024-01-03 18:21:26 +02:00
commit 77366f30cc
No known key found for this signature in database
15 changed files with 39 additions and 17 deletions

View file

@ -0,0 +1,4 @@
package me.imsonmia.epqapi.config;
public interface SqlConfig {
}

View file

@ -17,5 +17,6 @@ public class WebSocketConfig implements WebSocketMessageBrokerConfigurer {
@Override
public void registerStompEndpoints(StompEndpointRegistry registry) {
registry.addEndpoint("/ws").setAllowedOrigins("*");
}
}

View file

@ -13,6 +13,7 @@ public class Message {
@GeneratedValue(strategy = GenerationType.AUTO)
@Id
Long id;
MessageType type;
String fromUserId;
String toUserId;
String content;
@ -20,6 +21,9 @@ public class Message {
public Long getId() {
return id;
}
public MessageType getType() {
return type;
}
public String getFromUserId() {
return fromUserId;
}
@ -44,15 +48,20 @@ public class Message {
public void setTimeMillis(Long timeMillis) {
this.timeMillis = timeMillis;
}
public void setType(MessageType type) {
this.type = type;
}
public Message() {
}
public Message(Long id,
MessageType type,
String fromUserId,
String toUserId,
String content,
Long timeMillis) {
this.id = id;
this.type = type;
this.fromUserId = fromUserId;
this.toUserId = toUserId;
this.content = content;

View file

@ -0,0 +1,8 @@
package me.imsonmia.epqapi.model;
public enum MessageType {
MESSAGE,
SYSTEM,
HELLO,
DATA,
}