<EEVV>
what if I store `TCPConnection ref` from received method to my `TCPConnectionNotify` class? Can I do this
<SeanTAllen>
sorry, EEVV, what does that mean?
<SeanTAllen>
store where?
<SeanTAllen>
if you want to have all connections do something on a timer, you want an actor that all connections get registered with and a timer can send a message to that actor periodically and then, you can have the connections send the ping by call write on each of the tcp connections. each TCPConnectionNotify would have a tag for the actor that manages all the connections, and can add and remove the enclosing TCPConnection...
<SeanTAllen>
on connect and also on closed
<EEVV>
SeanTAllen, I understand that part, but is there a method for TCPConnectionNotify like `write`?
<EEVV>
I need access to `TCPConnection ref` but this is only given to you in the `received` method in `TCPConnectionNotify`
<SeanTAllen>
I dont understand
<SeanTAllen>
Based on the solution I gave, I'm not sure what you mean by your question or why it would be needed.
<EEVV>
SeanTAllen, question is how do you send data?
<EEVV>
from external actors
<SeanTAllen>
i dont understand
<SeanTAllen>
"how do you send data from external actors"?
<SeanTAllen>
are you asking how to send data over TCP using TCPConnection?
<EEVV>
yeah
<EEVV>
well
<EEVV>
no
<SeanTAllen>
then i dont understand
<EEVV>
I can send data when I have access to a `TCPConnection` with `write` method
<EEVV>
but I am only given `TCPConnection` in the `received` method
<SeanTAllen>
you didnt understand my solution
<SeanTAllen>
you an another actor that manages all connections
<EEVV>
I did understand
<SeanTAllen>
it can call write on each of those TCPConnections when data needs to be sent to all of them
<EEVV>
but you didn't explain how I would send the data
<SeanTAllen>
yes i did
<SeanTAllen>
you have the TCPConnections
<EEVV>
so can I pull TCPConnection from received?
<SeanTAllen>
no
<SeanTAllen>
the end of today i can post code for you
<SeanTAllen>
its 10 minutes to write the code but i have a busy day
<SeanTAllen>
you dont understand my solution, that's ok, its just words. i'll give you code eventually today
<EEVV>
I will try to figure it out then
<SeanTAllen>
create a new type of actor
<SeanTAllen>
call it ConnectionRegistry
<SeanTAllen>
have register and unregister methods on it
<SeanTAllen>
those take a TCPConnection
<SeanTAllen>
in your TCPConnectionNotify
<SeanTAllen>
when connected you call register and send the connection to the ConnectionRegistry
<SeanTAllen>
same approach on closed except call unregister
<EEVV>
ok but where I get this connection from?
<EEVV>
that's my problem
<SeanTAllen>
what connection?
<EEVV>
TCPConnection
<SeanTAllen>
go look at TCPConnectionNotify interface
<SeanTAllen>
every method gets the TCPConnection its being run by
<EEVV>
so I can pull TCPConnection from `accepted` method? And add to the registry?
<SeanTAllen>
you'd want to do it on connected not accepted, but yes
<EEVV>
but connected is part of listener and it doesn't contain a trade of `TCPConnection`
<EEVV>
trace*
<SeanTAllen>
please go look at TCPConnectionNotify
<SeanTAllen>
what should i look at in particular Candle ?
<Candle>
the states in the state machines are things like `type _GameState is ( _GameStart | _GameTurn | _GameEnd )` I'm not overly happy with how opaque their use is.
<Candle>
The `_GameTurn` states allow some form of information storage within the state; which also feels sub-optimal.
<SeanTAllen>
and then the matching, yes?
<Candle>
Yes, and then using match on the state.
<Candle>
The other main state machine is the netcat_player; again defined by `type _NcState is ( _NcStateWaiting | ....`