initial commit

This commit is contained in:
Zhongheng Liu 2023-12-21 12:32:56 +02:00
commit fe8af0fedf
No known key found for this signature in database
20 changed files with 953 additions and 0 deletions

View file

@ -0,0 +1,28 @@
package me.imsonmia.epqapi.messaging;
import com.google.gson.Gson;
import jakarta.websocket.DecodeException;
import jakarta.websocket.Decoder;
import jakarta.websocket.EndpointConfig;
public class MessageDecoder implements Decoder.Text<Message> {
private static Gson gson = new Gson();
@Override
public Message decode(String message) throws DecodeException {
return gson.fromJson(message, Message.class);
}
@Override
public void destroy() {
Text.super.destroy();
}
@Override
public void init(EndpointConfig endpointConfig) {
Text.super.init(endpointConfig);
}
@Override
public boolean willDecode(String s) {
// TODO Auto-generated method stub
return (s != null);
}
}