Apr-24-2017, 04:02 PM
HI Larz60+ ,
Thanks for your reply.
In the server side on IIS I enabled URL redirection.
I checked the logs on IIS where the first status is 307 then 200 success status.But here as there is no wait while connecting to the hub the first status 307 is returning back I think.
And I wrote a C# client for the same and its able to reach the signalr hub and the connection is establishing.In this case also in the logs i can see the status is first 307 then 200.
So i dont think i have to do anything on the server side.
I tried to use async and await in my scripts to wait till it connect but could not succeed(first time am using this and am new to Python).
I used asyncio python module .
below is my python client code:
Could you please tell what is wrong here.My intention is to write the script similar to the C# cde below.
Susmitha
Thanks for your reply.
In the server side on IIS I enabled URL redirection.
I checked the logs on IIS where the first status is 307 then 200 success status.But here as there is no wait while connecting to the hub the first status 307 is returning back I think.
And I wrote a C# client for the same and its able to reach the signalr hub and the connection is establishing.In this case also in the logs i can see the status is first 307 then 200.
So i dont think i have to do anything on the server side.
I tried to use async and await in my scripts to wait till it connect but could not succeed(first time am using this and am new to Python).
I used asyncio python module .
below is my python client code:
Quote:from requests import Session
from signalr import Connection
import asyncio
async def my_coroutine(connection,seconds_to_sleep):
connection.start()
await asyncio.sleep(seconds_to_sleep)
with Session() as session:
# Used to turn off certificate verification, without this you will get a SSLError
session.verify = False;
#create a connection
connection = Connection('http://189.70.78.89/Signalr', session);
#get chat hub
chat = connection.register_hub('ChatHub')
#start a connection
loop = asyncio.get_event_loop()
loop.run_until_complete(
asyncio.gather(my_coroutine(connection,5))
)
loop.close()
#start connection, optionally can be connection.start()
with connection:
while True:
#wait a second before exit
connection.wait(1)
Could you please tell what is wrong here.My intention is to write the script similar to the C# cde below.
Quote:var connection = new HubConnection('http://189.70.78.89/Signalr');Regards
//Make proxy to hub based on hub name on server
var myHub = connection.CreateHubProxy("ChatHub");
//Start connection
connection.Start().ContinueWith(task => {
if (task.IsFaulted) {
Console.WriteLine("There was an error opening the connection:{0}",
task.Exception.GetBaseException());
} else {
Console.WriteLine("Connected");
}
}).Wait();
Susmitha