Project

General

Profile

Proxy to be used for message transfer

Luca Stucchi
Added about 4 years ago

Hi there,

I was wondering how to implement this behavior:

I have some components of the system I am implementing that are only capable of HTTP/HTTPS connections, nothing more.

I want to enable them to fetch XMPP messages through a proxy, that will interact with Tigase, get the messages and send them back to my components.

I was wondering if it would be possible to use the SOCKS5 proxy for this scenario, or if I have to develop a standalone module: it would be great to use something ready, but it looks like the SOCKS5 Tigase proxy is a XEP-0065 implementation only.

I couldn't find any reference for something similar to what I need, do you think it could be implemented using SOCKS5 proxy ?

Thanks in advance,

Luca


Replies (6)

Avatar?id=6023&size=32x32

Added by Artur Hefczyc TigaseTeam about 4 years ago

Hm, what about Tigase own HTTP API (REST API). I think this would be the best and most direct access to the Tigase function over HTTP.

Added by Luca Stucchi about 4 years ago

Hi Artur, when I read about API it looked too simplistic, but I must have missed a piece: I'll look better, I see no reason to reinvent the wheel !

What about having this component active in a cluster ? I imagine that, activating it on all the cluster nodes, the API could be accessed on each of them, and there could even be a load balancer dispatching requests on the different servers. Is this an optimal solution, or there are better ideas to enable REST API access on more than a node ?

Thanks in advance,

Luca

Avatar?id=6023&size=32x32

Added by Artur Hefczyc TigaseTeam about 4 years ago

Luca Stucchi wrote:

Hi Artur, when I read about API it looked too simplistic, but I must have missed a piece: I'll look better, I see no reason to reinvent the wheel !

It is simple and it is meant to be simple, however, it is very powerful.

What about having this component active in a cluster ? I imagine that, activating it on all the cluster nodes, the API could be accessed on each of them, and there could even be a load balancer dispatching requests on the different servers. Is this an optimal solution, or there are better ideas to enable REST API access on more than a node ?

Yes, normally we deploy it on all cluster nodes and you can LB them using DNS round-robin. I think this is an optimal solution.

However, just a side note. Pulling messages via HTTP is far from optimal and makes sense only for small or low traffic installations. I would suggest in such a case to use either Bosh or even better to use Websockets.

Added by Luca Stucchi about 4 years ago

Hi there,

unfortunately I need HTTP because the component that needs to access the XMPP server has a limitation in connectivity that allows it only to perform an HTTP request taking a limited amount of time: that's why the HTTP API sounds perfect.

I modified some scripts in order to better understand how to implement what I need, and I was wondering: since I am authenticated, how can I get the XMPP messages waiting for me ? Should I first send an XMPP authentication packet or I can skip it ? Is there in the service groovy object a method to retrieve packets ? (something like service.sendPacket but on the opposite side....) ?

Thanks in advance,

Luca

Avatar?id=6023&size=32x32

Added by Artur Hefczyc TigaseTeam about 4 years ago

Luca Stucchi wrote:

Hi there,

unfortunately I need HTTP because the component that needs to access the XMPP server has a limitation in connectivity that allows it only to perform an HTTP request taking a limited amount of time: that's why the HTTP API sounds perfect.

Bosh is just a HTTP request, or series of requests. It is an XMPP protocol embedded in HTTP protocol.

I modified some scripts in order to better understand how to implement what I need, and I was wondering: since I am authenticated, how can I get the XMPP messages waiting for me ? Should I first send an XMPP authentication packet or I can skip it ? Is there in the service groovy object a method to retrieve packets ? (something like service.sendPacket but on the opposite side....) ?

While sending a message via HTTP API is quite simple and straightforward, retrieving a message waiting for a user via REST API is not so simple, unfortunately. This is because messages waiting for offline users are stored in database. So what you need to do, is implement a REST API call which loads the messages from database. I do not think you can simulate normal user's connection over REST API and trigger Tigase to send all messages this way. You can do this over Bosh, however.

Added by Luca Stucchi about 4 years ago

Now I know that HTTP REST API is not what I was looking for, my only aim was to fetch the XMPP messages waiting for a user that can't contact the XMPP server directly... thanks for your help in finding out that I can't easily do it !

    (1-6/6)