mandrewcito / signalrcore

SignalR Core python client
https://mandrewcito.github.io/signalrcore/
MIT License
119 stars 57 forks source link

Not working with self hosted Asp.NET.signalR server console app #22

Closed SaddamBInSyed closed 4 years ago

SaddamBInSyed commented 4 years ago

@mandrewcito Thanks for your work.

I am trying to communicate with a self-hosted SignalR server (Not .NET CORE app) with the below sample python script but I am getting the below error

Connection closed Connection is already closed.
Handshake status 400 Bad Request <class 'websocket._exceptions.WebSocketBadStatusException'>

Both .NET (self-host console app) and .NET core ( hosted on IIS) are tested with same PC

But the same below sample python code works fine with provided ASP.Net Core SignalRChat application.

sample test code:

`Using package from aspnet core - SignalRChat example chat without auth

from signalrcore.hub_connection_builder import HubConnectionBuilder def input_with_default(input_text, default_value): value = input(input_text.format(default_value)) return default_value if value is None or value.strip() == "" else value

server_url = input_with_default('Enter your server url(default: {0}): ', "ws://192.168.x.y:8080/chathub") username = input_with_default('Enter your username (default: {0}): ', "user1")

hub_connection = HubConnectionBuilder().with_url(server_url).with_automatic_reconnect({ "type": "raw", "keep_alive_interval": 10, "reconnect_interval": 5, "max_attempts": 5 }).build() hub_connection.on("ReceiveMessage", print) hub_connection.start() message = None while message != "exit()": message = input(">> ") if message is not None and message is not "" and message is not "exit()": hub_connection.send("SendMessage", [username, message]) hub_connection.stop()`

please advise, how to work with self-hosted application

mandrewcito commented 4 years ago

This library only works with signalr NET Core. When i started developing it there was a python signalr library. I dont know if has been recently updated so i dont know if it is still working https://pypi.org/project/signalr-client/

I'm sorry but signalr and signalr core are not compatibles https://docs.microsoft.com/en-gb/aspnet/core/signalr/version-differences?view=aspnetcore-3.1

SaddamBInSyed commented 4 years ago

Thanks for your reply.

well noted.