Auties00 / Cobalt

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

Connection timed out #31

Closed nekiak closed 3 years ago

nekiak commented 3 years ago

Using version 2.1

package com.nekiak.whatsapp;

import it.auties.whatsapp4j.api.WhatsappAPI;

public class Bot {
    public static void main(String... args) {
        var api = new WhatsappAPI();
        api.connect();
    }
}

and getting:

Exception in thread "main" java.io.IOException: UT003035: Connection timed out at io.undertow.websockets.jsr.ServerWebSocketContainer.connectToServerInternal(ServerWebSocketContainer.java:511) at io.undertow.websockets.jsr.ServerWebSocketContainer.connectToServerInternal(ServerWebSocketContainer.java:492) at io.undertow.websockets.jsr.ServerWebSocketContainer.connectToServer(ServerWebSocketContainer.java:226) at it.auties.whatsapp4j.socket.WhatsappWebSocket.openConnection(WhatsappWebSocket.java:210) at it.auties.whatsapp4j.socket.WhatsappWebSocket.connect(WhatsappWebSocket.java:194) at it.auties.whatsapp4j.api.WhatsappAPI.connect(WhatsappAPI.java:89) at com.nekiak.whatsapp.Bot.main(Bot.java:8)

Auties00 commented 3 years ago

Using version 2.1

package com.nekiak.whatsapp;

import it.auties.whatsapp4j.api.WhatsappAPI;

public class Bot {
    public static void main(String... args) {
        var api = new WhatsappAPI();
        api.connect();
    }
}

and getting:

Exception in thread "main" java.io.IOException: UT003035: Connection timed out at io.undertow.websockets.jsr.ServerWebSocketContainer.connectToServerInternal(ServerWebSocketContainer.java:511) at io.undertow.websockets.jsr.ServerWebSocketContainer.connectToServerInternal(ServerWebSocketContainer.java:492) at io.undertow.websockets.jsr.ServerWebSocketContainer.connectToServer(ServerWebSocketContainer.java:226) at it.auties.whatsapp4j.socket.WhatsappWebSocket.openConnection(WhatsappWebSocket.java:210) at it.auties.whatsapp4j.socket.WhatsappWebSocket.connect(WhatsappWebSocket.java:194) at it.auties.whatsapp4j.api.WhatsappAPI.connect(WhatsappAPI.java:89) at com.nekiak.whatsapp.Bot.main(Bot.java:8)

This is actually an issue with undertow's WebSocket implementation. I'm working on getting the one built-in java to work, this should not take me more than a couple of days. Usually, restarting your application will solve this issue though

SLAYER-CODE commented 3 years ago

Is this problem related to this?

Note: C:\Users\ADMIN\IdeaProjects\RobotWatsap\src\test\java\Wat\New\Main.java uses preview language features.
Note: Recompile with -Xlint:preview for details.

> Task :Main.main()
Exception in thread "ForkJoinPool.commonPool-worker-19" java.lang.IllegalArgumentException: Cannot find ref for QR code generation
    at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:78)
    at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
    at java.base/java.lang.reflect.Constructor.newInstanceWithCaller(Constructor.java:499)
    at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:480)
    at it.auties.whatsapp4j.utils.internal.Validate.isTrue(Validate.java:49)
    at it.auties.whatsapp4j.utils.internal.Validate.isTrue(Validate.java:36)
    at it.auties.whatsapp4j.socket.WhatsappWebSocket.generateQrCode(WhatsappWebSocket.java:103)
    at it.auties.whatsapp4j.socket.WhatsappWebSocket.lambda$generateQrCode$0(WhatsappWebSocket.java:102)
    at java.base/java.util.concurrent.ForkJoinTask$RunnableExecuteAction.exec(ForkJoinTask.java:1434)
    at java.base/java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:295)
    at java.base/java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(ForkJoinPool.java:1016)
    at java.base/java.util.concurrent.ForkJoinPool.scan(ForkJoinPool.java:1665)
    at java.base/java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1598)
    at java.base/java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:183)
nekiak commented 3 years ago

This is actually an issue with undertow's WebSocket implementation. I'm working on getting the one built-in java to work, this should not take me more than a couple of days. Usually, restarting your application will solve this issue though

I've not been able to make a single connection though.

Auties00 commented 3 years ago

This is actually an issue with undertow's WebSocket implementation. I'm working on getting the one built-in java to work, this should not take me more than a couple of days. Usually, restarting your application will solve this issue though

I've not been able to make a single connection though.

this is weird, are you in some particular country where WhatsApp web's access is restricted(ex. China)?

Auties00 commented 3 years ago

Is this problem related to this?

Note: C:\Users\ADMIN\IdeaProjects\RobotWatsap\src\test\java\Wat\New\Main.java uses preview language features.
Note: Recompile with -Xlint:preview for details.

> Task :Main.main()
Exception in thread "ForkJoinPool.commonPool-worker-19" java.lang.IllegalArgumentException: Cannot find ref for QR code generation
  at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
  at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:78)
  at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
  at java.base/java.lang.reflect.Constructor.newInstanceWithCaller(Constructor.java:499)
  at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:480)
  at it.auties.whatsapp4j.utils.internal.Validate.isTrue(Validate.java:49)
  at it.auties.whatsapp4j.utils.internal.Validate.isTrue(Validate.java:36)
  at it.auties.whatsapp4j.socket.WhatsappWebSocket.generateQrCode(WhatsappWebSocket.java:103)
  at it.auties.whatsapp4j.socket.WhatsappWebSocket.lambda$generateQrCode$0(WhatsappWebSocket.java:102)
  at java.base/java.util.concurrent.ForkJoinTask$RunnableExecuteAction.exec(ForkJoinTask.java:1434)
  at java.base/java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:295)
  at java.base/java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(ForkJoinPool.java:1016)
  at java.base/java.util.concurrent.ForkJoinPool.scan(ForkJoinPool.java:1665)
  at java.base/java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1598)
  at java.base/java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:183)

This is related to this issue

nekiak commented 3 years ago

This is actually an issue with undertow's WebSocket implementation. I'm working on getting the one built-in java to work, this should not take me more than a couple of days. Usually, restarting your application will solve this issue though

I've not been able to make a single connection though.

this is weird, are you in some particular country where WhatsApp web's access is restricted(ex. China)?

No. I've been using Baileys with no issues whatsoever so I don't think that's the case.

SLAYER-CODE commented 3 years ago

In the same way my country is not restricted and I used whatsappweb4j-request-analyzer-1.0 and it worked correctly.

Auties00 commented 3 years ago

This is actually an issue with undertow's WebSocket implementation. I'm working on getting the one built-in java to work, this should not take me more than a couple of days. Usually, restarting your application will solve this issue though

I've not been able to make a single connection though.

this is weird, are you in some particular country where WhatsApp web's access is restricted(ex. China)?

No. I've been using Baileys with no issues whatsoever so I don't think that's the case.

I'm working on shipping the fixed version asap, sadly there is a weird bug I'm investigating. I should be done in a couple days though

DevOFVictory commented 3 years ago

Same issue. Looking forward to the fix :) But i didn't understand how to connect the number. Do I have to scan a QR Code with my connected phone and where will it appear?

Auties00 commented 3 years ago

t understand how to connect the number. Do I have to scan a QR Code with my connected phone and where will it appear?

yes, it will appear on the terminal

Auties00 commented 3 years ago

I'm working on a dependency for this project, once it's done the issue will be fixed. Sorry for the delay

Auties00 commented 3 years ago

@DevOFVictory @nekiak A new version(2.1.1) is now available, the issue should be fixed, let me know if I can close the issue

nekiak commented 3 years ago

@DevOFVictory @nekiak A new version(2.1.1) is now available, the issue should be fixed, let me know if I can close the issue

Yeah, just tested it. Seems to be working just fine. Closing this...