Auties00 / Cobalt

Standalone unofficial fully-featured Whatsapp Web and Mobile API for Java and Kotlin
MIT License
611 stars 179 forks source link

Can't deserialize #464

Closed DanielSchiavo closed 3 months ago

DanielSchiavo commented 3 months ago

dasda

I have tried a lot methods to deserialize without get error, I'm trying about 2 days

I'm using version 0.0.2 of cobalt I'm using 0.0.2 because when I use 0.0.3 I can't log in with QR code because every time it generates an error

I was told "Read the documentation, new connection cannot be registered. Use the last connection or a specific one" I don't understand, the registered method says: "Creates a Whatsapp instance without handlersThis method assumes that you have already logged in using a QR code or OTPOtherwise it returns an empty optional.", if newConnection retrieves a connection that The WhatsappOldEligible method and registered creates a Whatsapp instance assuming you have already logged in using QR code or OTP, what is the registered method for?

The GET method is working fine, the serialization is working correctly and I am using newConnection -> unregistered -> conect -> join in it To retrieve a connection it must then be newConnection (since it retrieves a connection or creates) -> registered (because it was serialized) -> connect -> join, but apparently I can't use registered with newConnection, the newConnection method returns a WebOptionsBuilder , how should I get a Whatsapp object if I can't use the registered method? I don't see how

How can I recover a session then? please answer me with an example method The documentation says nothing about retrieve a connection by deserializing

When I start the server and log in with qr code with this GET method, then I send a request to this POST method, everything works fine, but when I turn the server off and on, and send a request directly to this POST method (without send a request to the GET method), I receive the following error:

2024-03-09T21:06:47.276-03:00 ERROR 18128 --- [onPool-worker-1] ErrorHandler : Socket failure at MESSAGE java.util.concurrent.CompletionException: java.lang.NullPointerException: Cannot invoke "it.auties.whatsapp.socket.SocketSession.sendBinary(byte[])" because "session" is null at java.base/java.util.concurrent.CompletableFuture.encodeThrowable(CompletableFuture.java:315) at java.base/java.util.concurrent.CompletableFuture.completeThrowable(CompletableFuture.java:320) at java.base/java.util.concurrent.CompletableFuture$UniCompose.tryFire(CompletableFuture.java:1159) at java.base/java.util.concurrent.CompletableFuture$Completion.exec(CompletableFuture.java:483) at java.base/java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:387) at java.base/java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(ForkJoinPool.java:1312) at java.base/java.util.concurrent.ForkJoinPool.scan(ForkJoinPool.java:1843) at java.base/java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1808) at java.base/java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:188) Caused by: java.lang.NullPointerException: Cannot invoke "it.auties.whatsapp.socket.SocketSession.sendBinary(byte[])" because "session" is null at it.auties.whatsapp.socket.SocketRequest.send(SocketRequest.java:104) at it.auties.whatsapp.socket.SocketRequest.send(SocketRequest.java:166) at it.auties.whatsapp.socket.SocketHandler.send(SocketHandler.java:442) at it.auties.whatsapp.socket.SocketHandler.send(SocketHandler.java:429) at it.auties.whatsapp.socket.SocketHandler.sendQuery(SocketHandler.java:425) at it.auties.whatsapp.socket.SocketHandler.sendQuery(SocketHandler.java:405) at it.auties.whatsapp.socket.MessageHandler.queryDevices(MessageHandler.java:597) at it.auties.whatsapp.socket.MessageHandler.getDevices(MessageHandler.java:585) at it.auties.whatsapp.socket.MessageHandler.encodeConversation(MessageHandler.java:446) at it.auties.whatsapp.socket.MessageHandler.lambda$encodeChatMessage$0(MessageHandler.java:97) at java.base/java.util.concurrent.CompletableFuture$UniCompose.tryFire(CompletableFuture.java:1150) ... 6 more

Auties00 commented 3 months ago

I've just released a new version, 0.0.4, which fixes this issue