Watch, Follow, &
Connect with Us

For forums, blogs and more please visit our
Developer Tools Community.


Welcome, Guest
Guest Settings
Help

Thread: Sending Data From TIdHttpServer to none connected clients!


This question is answered.


Permlink Replies: 5 - Last Post: Sep 13, 2016 11:45 AM Last Post By: Remy Lebeau (Te...
Ahmed Sayed

Posts: 173
Registered: 8/9/07
Sending Data From TIdHttpServer to none connected clients!  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Sep 9, 2016 9:00 AM
Hi all,

I was wondering if a server can send data to client without
the need for a client to request data first.

My idea is:

1- On client app startup it sends a normal https requested
saying I am online with url path of "/connected". The connection
must not be alive all the time (Stateless).

2- On server side the app stores the client ip address and names
of datasets that this user deals with to be used later
and a response message saying that client ip is stored OK.

3- When one of the clients edits one of their datasets, a request is sent
to the server that a table with a specific name has changed and that
any user who also has this table opened must be notified. At this point
the response for the client who made the request is not important at all.

4- So the server query clients that has this table opened. When the server
find one it sends it a message with the table name that needs refreshing.
Remember the connection is not kept alive.

5- The client should receive the message whether by using another
TIdHttpServer to listen on the same port or TIdTCPClient or server.
I don't know what the best thing here?

6- All this has to be done using SSL with certificates only on the
server side.

Any help will be really appreciated. Thanks in advance

--
The limits of my language mean the limits of my world

Remy Lebeau (Te...


Posts: 9,447
Registered: 12/23/01
Re: Sending Data From TIdHttpServer to none connected clients!  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Sep 12, 2016 2:28 PM   in response to: Ahmed Sayed in response to: Ahmed Sayed
Ahmed wrote:

I was wondering if a server can send data to client without
the need for a client to request data first.

HTTP is a command/response protocol. An HTTP server is not allowed to send
something that a client has not requested first.

My idea is:

Your idea requires server-side pushing:

https://en.wikipedia.org/wiki/Push_technology

Each client would have to stay connected to the server (no stateless handling!)
so the server can push notifications to each client when needed. That can
be done with HTTP, but it is not really meant for that.

If you don't want to maintain persistent connections, then either:

1. the server will have to make its own outbound connections to remote clients
when needed.

2. the clients will have to reconnect periodically to check for pending notifications.

3. use UDP instead of TCP.

--
Remy Lebeau (TeamB)
Ahmed Sayed

Posts: 173
Registered: 8/9/07
Re: Sending Data From TIdHttpServer to none connected clients!  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Sep 13, 2016 5:41 AM   in response to: Remy Lebeau (Te... in response to: Remy Lebeau (Te...
Thanks,

But UDP can't be used with ssl? how can i encrypt the
data sent from the server?

--
The limits of my language mean the limits of my world
Remy Lebeau (Te...


Posts: 9,447
Registered: 12/23/01
Re: Sending Data From TIdHttpServer to none connected clients!  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Sep 13, 2016 8:47 AM   in response to: Ahmed Sayed in response to: Ahmed Sayed
Ahmed wrote:

But UDP can't be used with ssl?

Yes it can, via Datagram Transport Layer Security (DTLS).

--
Remy Lebeau (TeamB)
Ahmed Sayed

Posts: 173
Registered: 8/9/07
Re: Sending Data From TIdHttpServer to none connected clients!  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Sep 13, 2016 9:40 AM   in response to: Remy Lebeau (Te... in response to: Remy Lebeau (Te...
And where is that DTLS thing in indy components?

--
The limits of my language mean the limits of my world
Remy Lebeau (Te...


Posts: 9,447
Registered: 12/23/01
Re: Sending Data From TIdHttpServer to none connected clients!
Correct
Click to report abuse...   Click to reply to this thread Reply
  Posted: Sep 13, 2016 11:45 AM   in response to: Ahmed Sayed in response to: Ahmed Sayed
Ahmed wrote:

And where is that DTLS thing in indy components?

OpenSSL has an API for DTLS, but Indy does not implement DTLS at this time
(though there are a few DTLS related functions declared in the IdSSLOpenSSLHeaders
unit, but not all of them). You would have to use the API directly.

--
Remy Lebeau (TeamB)
Legend
Helpful Answer (5 pts)
Correct Answer (10 pts)

Server Response from: ETNAJIVE02