none
Camera communicates with SignalR connection RRS feed

  • Question

  • Hello

    I have a client with over 800 IP cameras - the kind that count people & vehicles entering and leaving a zone.

    these camera can initiate contact with a service via a socket mechanism.

    I was hoping that SignalR could be the platform to do this, I am not sure yet it I will self-host or use IIS & WebAPI yet. I'm sure the code is not so different in that respect.

    the camera opens communication with something like this

    43

    action=hello&mac=<macaddress>&type=nvc&etc..

    the "43" is the length of the text begin sent in the request

    And then I am expected to respond with a command to the camera eg:

    45

    action=update&<parms>

    The camera will respond with

    2

    OK

    and I can do as many of these as I like.

    when I am done I do

    4

    DONE

    and that ends the communication.

    My main purpose with the camera is to have it send hourly counts of the people for live updates to my client

    So What I am going to get is (hopfully) is a HTML table of data. which I then parse out using existing code which I already have.

    I've got a basic scaffold of code using persistent connection and a console app which I use to mock the camera.

    I can get a connection between the two and the client can send a string to the server, But haven't figured out how the server sends data back to the client. And then also how I can have a "conversation" going between the two. Including sending these message length numbers. 

    Most examples I've seen are some kind of chat programme which broadcasts the changes/text to every client connected. definitly not what I need - I need a conversation only between server and camera. For each of 800 cameras that will connect every hour to send an update.

    Hoping someone has some tips out there.

    Thanks

    Salik


    Oracle, SQL Server databases designed and built

    Tuesday, January 14, 2014 7:15 PM

Answers

  • I don't think signalR can be used according to your description below is the description from the microsoft webpage.  You description says the client sends messages and wiats for a response.  the signalR descript below says "server push content ..., rather than saving server wait for client".  Your data appears to just be ascii messages while SignalR is http.

     

    What is SignalR?

    ASP.NET SignalR is a library for ASP.NET developers that simplifies the process of adding real-time web functionality to applications. Real-time web functionality is the ability to have server code push content to connected clients instantly as it becomes available, rather than having the server wait for a client to request new data.


    jdweng

    Wednesday, January 15, 2014 10:30 AM

All replies

  • You have a Master (client)/ Slave (server) Application.  The client wil intiate a command and the server will respond with a messsage.  Each message must have a method to determine the end of a message and the receiving code waits until the end of message is recevied before processing and responding.  Normal methods for determing end of message is one of the following

    1) Ascii - fxed character like an end of line

    2) Ascii or Binary - A byte count is added to the beginning of each messaage.  the receive end reads byte count and then continues reading until all the bytes arre received

    3) Ascii or binary - Fixed message lengths.  Each message type has a specfic format and deterministic length.


    jdweng

    Tuesday, January 14, 2014 7:23 PM
  • That was informative, but not really what I was seeking.

    I was more seeking a general pseudo code of how this would be done in SignalR - or even in sockets in general. My experience is in web apps, web services so not had to work at this level before.

    I've looked at the SignalR docs and can see PersistentConnection which seems the choice. The recieves come via event notices..I've to keep track of which camera sent what text and probably some context information as I'm having a conversation with the camera.

    Am I on the right track here.

    Thanks.


    Fantastic .Net apps and financial apps www.us3software.com

    Wednesday, January 15, 2014 9:58 AM
  • I don't think signalR can be used according to your description below is the description from the microsoft webpage.  You description says the client sends messages and wiats for a response.  the signalR descript below says "server push content ..., rather than saving server wait for client".  Your data appears to just be ascii messages while SignalR is http.

     

    What is SignalR?

    ASP.NET SignalR is a library for ASP.NET developers that simplifies the process of adding real-time web functionality to applications. Real-time web functionality is the ability to have server code push content to connected clients instantly as it becomes available, rather than having the server wait for a client to request new data.


    jdweng

    Wednesday, January 15, 2014 10:30 AM