Jump to content

Recommended Posts

Hi,

 

Is there an example of using ICS to create a server that supports webhook subscriptions?

 

https://codeburst.io/what-are-webhooks-b04ec2bf9ca2

 

The Idea is for the consumer to send a REST JSON message detailing what he subscribes to, containing the URL he needs the data on.

The server would then send all new events to the consumer as and when it happens.

SSL would be needed.

 

What I need to know is would it be possible to keep the reverse connection open and send messages over it for a period of a full day?

Depending on frequency the overhead of re-establishing sessions could become too expensive.

 

Thanks,

JP

 

Share this post


Link to post

I've looked at a couple of pages on webhooks and still have no idea which end is listening and which is sending, or what.  Someone will need to explain this as simple HTTP concepts. 

 

The ICS HTTP client has keep-alive that leave connections open potentially for days or weeks, the HTTP server has a timeout to stop that happening.

 

Angus

 

Share this post


Link to post
8 hours ago, JP_Pienaar said:

Is there an example of using ICS to create a server that supports webhook subscriptions?

There is no such example in ICS.

Are you interested by the server side (I mean Web server)or by the client side (I mean Web browser)?

 

Share this post


Link to post

I would be supplying the "Web" server.

The client is not a browser but a data consumer written in another language.

The client needs to subscribe to me, I believe the client would start listening for a connection/s from me once he successfully subscribed.

So both me and him would be both listening and initiating connections. (If he needs feeds on 2x separate subjects he would need to subscribe twice, specifying 2x URLs for me to send to)

In order to test I would be writing both sides anyway. (in Delphi)

 

I will attempt a solution and if it works well share an example.

 

Thanks

Share this post


Link to post

Judging from the provided link alone a webhook is a server running on the client side. The client, when initiating a connection to a "real" server will provide this address to said server. This means, the server will need a client socket itself, and has to be able to connect to that mini server on the client side. It is a nifty concept to reduce open connections on the server side. Also the clients need not ask if a time consuming task is done, they will be notified via web hook. This concept will be rendered useless by firewalls, proxies and other sane security measures. Possibly only something for a LAN application. But in that case, the server might just dump the result of aforementioned lengthy operation into a samba share and the client could poll that every so often. No webhook needed. Unless the result is not dumpable...which I highly doubt.

Share this post


Link to post
Quote

Judging from the provided link alone a webhook is a server running on the client side.

That was where I was getting confused, a server running on the client is simple but unlikely to work in 99% of cases unless the client has a unique public IP address, most of us block incoming connections, use NAT., dynamic IP addresses, firewalls, etc.  But leaving a connection open to a remote server is even worse once you have more than a few hundred clients, servers can only handle a few thousand simultaneous connections at best.  Still no idea what a data consumer means. 

 

If it is a local web server and only needs to handle simple notifications to update pages, then the new TSimpleWebSrv added recently is lightweight and easier to implement than the full web server, ICS uses it for Let's Encrypt authentication requests and OAuth2. 

 

Angus

Share this post


Link to post

The intent is to feed real-time data internally (from one server to another inside the same firm).

The client requested web-hooks, with a snapshot sent upon subscription (from last sequence specified in subscription detail) and live feeds thereafter. (All JSON)

There are no web pages or browsers involved.

Certs are required as their software sits in a DMZ.

Share this post


Link to post

i think the only way is to create one yourself, but for the community i think it would be good to have more of these new socket services...

 

I am currently using a webhook from tradingview for alert notifications, but i guess it's not really the same webhook, more or less its just sending a post to my own server.

 

 

Share this post


Link to post
On 9/30/2019 at 2:53 PM, Sherlock said:

This concept will be rendered useless by firewalls, proxies and other sane security measures.

Yes, this is the problem. Firebird "Events" that go the other way have similar problems.

A "Gateway" type of setup will fix these problems as both servers and clients become clients to the gateway.

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×