Try to fix some stuff with websocket

This commit is contained in:
Marc Baloup 2023-03-16 12:29:43 +01:00
parent fdfb67757f
commit 2fb4775ca7
2 changed files with 5 additions and 3 deletions

View File

@ -110,7 +110,7 @@ public abstract class AbstractClientWS implements AbstractWS {
public final void sendClose(int code, String reason) throws IOException { public final void sendClose(int code, String reason) throws IOException {
synchronized (socket) { synchronized (socket) {
autoReconnect = false; // if we ask for closing connection, dont reconnect automatically autoReconnect = false; // if we ask for closing connection, dont reconnect automatically
socket.get().sendClose(code, reason); socket.get().sendClose(code, reason).join();
} }
} }

View File

@ -1,5 +1,7 @@
package fr.pandacube.lib.ws.payloads; package fr.pandacube.lib.ws.payloads;
import fr.pandacube.lib.util.ThrowableUtil;
/** /**
* Error message payload. * Error message payload.
*/ */
@ -11,7 +13,7 @@ public class ErrorPayload extends Payload {
/** /**
* The error Throwable, may be null. * The error Throwable, may be null.
*/ */
public Throwable throwable; public String exception;
/** /**
* Initialize an error payload with a message but not throwable. * Initialize an error payload with a message but not throwable.
@ -28,7 +30,7 @@ public class ErrorPayload extends Payload {
*/ */
public ErrorPayload(String message, Throwable throwable) { public ErrorPayload(String message, Throwable throwable) {
this.message = message; this.message = message;
this.throwable = throwable; this.exception = ThrowableUtil.stacktraceToString(throwable);
} }
@SuppressWarnings("unused") @SuppressWarnings("unused")