Making Erlang RPC calls from Swift over ei

We’re using ei to create a connection from Swift as an Erlang node to an Erlang (Elixir) app. We’re running into a strange issue where we want to make a synchronous call over Erlang’s rpc but still need to respond to TICK messages coming in to keep the connection alive.

Is there a recommended pattern to do this? We could fire and forget the rpc call then detect the response message in our blocking receive loop but then we loose the benefit of making a synchronous call.

The receive loop will currently sometimes “steal” to response message from our rpc call.

I don’t have much experience with ei, however it sounds like you just need to loop, but I feel like there’s a detail I’m not groking or not mentioned in your post.

Have a look at ei_tmo_test.c and let the forum know if this is what you were after

We fixed it, there was a deadlock happening that prevented the receiver loop for actually getting what we wanted.