Let's consider we need to write some kind of REST "proxy" to other backend, DB or smth else with connections.
So our tasks are
opens listen socket (solved by WispServer and WebMods)
opens connections to backend and perform tasks, return results to our clients.
What we do not want - constant reconnections of those connections. We need to store already opened sockets. Here is an issue, WebMod (as Actor) is constant. Also, ConcurentMap requires constantness for values. We could not make opened connections constant, we could not pass em as messages.
So, how, architecturally we could implement this in Fantom ?
brianMon 5 Nov 2018
What I typically do is spawn off an actor and then pass the socket to it as a message using sys::Unsafe. Its about the only time I ever use Unsafe, but in this case as long as the actor who accepts the socket never touches it and transfers ownership of the socket to another actor then its ok.
controlsforallMon 5 Nov 2018
We can be more explicit of our goals as the person who wrote sedona is working on fantom.
We are trying to start on the process of writing Sox to Web sessions translator
From here we will link the html5 GUI to a javascript library
Andrey Zakharov Mon 5 Nov 2018
Hello all!
Let's consider we need to write some kind of REST "proxy" to other backend, DB or smth else with connections.
So our tasks are
What we do not want - constant reconnections of those connections. We need to store already opened sockets. Here is an issue, WebMod (as Actor) is constant. Also, ConcurentMap requires constantness for values. We could not make opened connections constant, we could not pass em as messages.
So, how, architecturally we could implement this in Fantom ?
brian Mon 5 Nov 2018
What I typically do is spawn off an actor and then pass the socket to it as a message using
sys::Unsafe
. Its about the only time I ever use Unsafe, but in this case as long as the actor who accepts the socket never touches it and transfers ownership of the socket to another actor then its ok.controlsforall Mon 5 Nov 2018
We can be more explicit of our goals as the person who wrote sedona is working on fantom.