Differents uses about contacting client from the server

Hi.
I’m interrested about talking around the differents ways to notify client about something from server.
Ideally, I would be interrested about calling a client method from the server by passing the userId. I looked around this old package : anti:methods but it doesn’t work now.
Is passing by a mongoCollection is still the only one solution ?

Often I’m using callbacks method successfully, but here is my problematic :
I have a http server writed in java on a server A.
My Meteor project is on another server B.
When I upload a file from my client to meteor, it uploads successfully on the server B. Then, it called the java’s http server to get this file from it. Now the java accomplished the download an notify meteor server it’s ok (or it failed). Then now, I would like to notify client the download is ok on the java server (or it failed too :p).
But the time between upload file and getting confirmation can be long… I just can’t loop, or whatever, to wait a callback.

What will be the best way to do that ?

Sorry if my explications aren’t well explained.
Thanks for your advices.

Hi,

maybe you could use Meteor’s DDP protocol. There’s also a DDP Client implementation for Java

We’re using a Java DDP client to connect with a Meteor microservice. We use client (Java) calls to methods on the microservice when the client needs to “tell” Meteor something, and we use pub/sub to enable the microservice to “tell” the client something.

Hi and thanks for your answers.
I just seen quickly what DDP is, and yes, it’s probably what I have to work on.
I will comment back after my first tries :wink:

Here is my feedback,
I tried to investigate in ddp, was really interresting but seems hard to call function with.

I chose to used meteor-user-session package and made it works with the currents meteor’s version.
This package allow me to use session on both server and client side. So it allow 3 arguments in a UserSession variable who is reactive on the client side and using it in the deps.autorun, I can call a client’s side function with two arguments in the UserSession. I pushed it a bit while creating a telnet client streaming and it’s pretty effective tbh and it answered my needs. If interrested, I can asked to BenjaminRH to git his package a bit changed.