Gurgen / SignalR-.net-core-android-client

Apache License 2.0
129 stars 34 forks source link

Server Error #3

Closed hezhipengzipp closed 6 years ago

hezhipengzipp commented 6 years ago

I use this progrom, java.lang.RuntimeException: Server error, can you tell me ,how to detail with it

Gurgen commented 6 years ago

Can you show code. How do you connect?

santhoshpulliman commented 6 years ago

Getting same error, below is my code `public class MainActivity extends AppCompatActivity implements HubConnectionListener, HubEventListener { public static final String CONNECT_URL = "http://192.168.26.214/"; private WebSocketHubConnection connection; private ServerConnection mServerConnection;

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    connection = new WebSocketHubConnection(PPVIDEO_CONNECT_URL, "");
    connection.connect();
    connection.addListener(this);
    connection.subscribeToEvent("System", this);

}

@Override
protected void onDestroy() {
    super.onDestroy();
    connection.disconnect();
}

@Override
public void onConnected() {
    System.out.println("Signalr Connected");
}

@Override
public void onDisconnected() {
    System.out.println("Signalr Disconnected");
}

@Override
public void onMessage(HubMessage message) {
    System.out.println("Signalr Message: " + message);
}

@Override
public void onError(Exception exception) {
    System.out.println("Signalr exception: " + exception);
}

@Override
public void onEventMessage(HubMessage message) {
    System.out.println("Event Message: " + message.getArguments().toString());
}`
Gurgen commented 6 years ago

Can you debug connect process and tell me line from where throws RunTimeException?

santhoshpulliman commented 6 years ago

In WebSocketHubConnection.java line number 160. that is 'onError'callback of WebSocketClient

Gurgen commented 6 years ago

And what is exception? There is a ex param

santhoshpulliman commented 6 years ago

some issues in the url. now onClosed callback is invoked. so might be issue at the server. Thanks for the reply

Gurgen commented 6 years ago

Yes, I think issue on server side, but if any problems, please write here

santhoshpulliman commented 6 years ago

I am facing an issue when the SignalR server is hosted in Azure. Locally hosted server code is working fine. HubConnectionListener.onDisconnected() is invoked when connecting azure hosted SignalR. The azure hosted thing is working fine in javascript SDK but not in Android. Any extra details should be sent from Android implementation?

Gurgen commented 6 years ago

Can you provide me your azure host address, I will check?

Gurgen commented 6 years ago

Thank you @santhoshpulliman , fixed