blob: 5fac39152f3fc1cefaf1f5d1b20c34014803f8f3 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
|
package me.imsonmia.epqapi.messaging;
import com.google.gson.Gson;
import jakarta.websocket.EncodeException;
import jakarta.websocket.Encoder;
import jakarta.websocket.EndpointConfig;
public class MessageEncoder implements Encoder.Text<Message> {
private static Gson gson = new Gson();
@Override
public String encode(Message message) throws EncodeException {
return gson.toJson(message);
}
@Override
public void destroy() {
Text.super.destroy();
}
@Override
public void init(EndpointConfig endpointConfig) {
Text.super.init(endpointConfig);
}
}
|