locked
new guy seeking assisting to find the right way. RRS feed

  • Question

  • User1277549898 posted

    i am brand new too signalr.

    i managed to get the " moveshape demo to work
    but im trying to figure out if i can just send 1 string or array of light data
    every 1 second to the clients. clients not have to send back anything.
    can someone please help  me. i feel totaly lost reading into the site info.
    my c# is not that strong.

    i got a c# script generating a string of realtime data every 0.3 seconds.

    which i would love to  transfer from c# host to the javascript client  every 1 second.
    example of string  is  string ann = "0,1,2,1,2,1,0,244,15"

    shortly said how do i "transfer String ann every second to the javascript client.
    ofcourse im stil trying to read and study about this . but honestly i dont understand half of the signalr workings.


    michiel

    Wednesday, March 11, 2020 3:48 PM

All replies

  • User283571144 posted

    Hi michielsweb,

    "transfer String ann every second to the javascript client.

    Before telling you about how to transfer string to the javascript client side, we need to know when we will start to transfer the data, which client we will transfer the data.

     Asp.net core signalr hub:

    For example, we will start to transfer the data when the page loaded to all the clients,  we could use asp.net core BackgroundService to achieve this requirement.  Details about how to do it, you could refer to below codes:

    BackgroundService

    Startup.cs

    Asp.net hub:

    We could use System.Timers.Timer library to achieve this requirement. Details, you could refer to this article.

    Brando

    Thursday, March 12, 2020 6:50 AM
  • User1277549898 posted

    hi Brando first off all.

    Thank you for ure time to respond! 
    as i am trying to study/ understand the URLS u sendend.

    i try to answer some of your questions.

    i would love to transfer data as soon as client connects. or just try send it whenever server is online  if thats easier.
    basicly the c# program i have is reading some warning lights & arrow directions on 3 gauges  out of my  flightsim using the proper sdk ofcourse.
    it turns the data into a simple string

    basicly i want to load a server in c#  .exe
    start server >
    --> send string function or snippet. (i can add it too the continues data sending loop timer.)
    --> how to read the string in javascript.
    close server > wil happen automatic on software close i asume.




    i have created a small html page where javascript is waiting  the data and transfers it by turning the right lights on or off.
    so in the ideal world once the seperate data sending  project is working i would love to able to just merge the projects and call a function or run the transfer script in my timer loop. 

    if there is a way u can help me how i can send " string"  from server  to client and how to read it.
    i can mess further inside  vs because that is the main info i cant seem to find sadly

    Thursday, March 12, 2020 8:20 AM
  • User1277549898 posted

    close topic pls i went whit sockets could get it too work already

    Friday, March 13, 2020 10:15 AM
  • User283571144 posted

    Hi michielsweb,

    I'm glad that you have solved the issue by yourself. Could you please post the details information about how you solved the issue and mark it as answer?

    This will help other people who faces the same issue and find the solution more easily.

    Thank you very much.

    Best Regards,

    Brando

    Monday, March 16, 2020 1:38 AM