Net::A...Server(3pm)

πŸ“¦
version 0.16 Β· 3 versions
, in ubuntu noble, ubuntu resolute, ubuntu stonking

✨ Net::Async::Tangence::Server ✨

okay bestie so this is Net::Async::Tangence::Server, a Perl module (that's the 3pm part, we're in User Contributed Perl Documentation territory, very demure, very mindcore) and it's literally here to let you serve up Tangence clients using IO::Async. yup. that's the whole vibe. πŸ’…


🌸 DESCRIPTION 🌸

so this lil cutie is a subclass of IO::Async::Listener, and what does that mean for the girlies? it means it accepts Tangence client connections. that's it. that's the job. she listens, she accepts, she serves. main character energy fr fr πŸŽ€


πŸ’– PARAMETERS πŸ’–

here's the tea β€” these named parameters can be passed to new or configure (either one, she's flexible like that ✨):

  • registry => Tangence::Registry β€” the Tangence::Registry that holds all the server's objects. literally the whole point. don't forget her πŸ‘‘

πŸ‘‘ OVERRIDEABLE METHODS πŸ‘‘

okay so these methods come pre-baked but they're intended to be overridden if your implementing class wants to do something different from the default behaviour. like, they're doing their best out of the box, but you're allowed to take the wheel bestie πŸš—πŸ’¨

πŸ¦‹ conn_rootobj πŸ¦‹

$rootobj = $server->conn_rootobj( $conn, $identity )

this gets invoked whenever a "GETROOT" message shows up from the client, and it should return a Tangence::Object to be the root object for that connection. iconic.

the default implementation? it just returns the object with ID 1. aka the very first object created in the registry. simple, effective, slay. ✨

🌈 conn_permits_registry 🌈

$allow = $server->conn_permits_registry( $conn )

this one gets called when a "GETREGISTRY" message shows up from the client on the given connection object. it should return a boolean β€” yes or no, green light or red flag 🚦 β€” saying whether this client is even allowed to access the object registry.

the default implementation always permits this, but an overridden method is fully allowed to say "no ma'am" in certain situations. and here's the important part:

when this is disabled, a client won't be able to gain access to any serverside objects other than the root object β€” and (recursively) any other objects returned by methods, events or properties on objects it already knows about.

so basically it's a security mechanism. lock the door, keep the registry to yourself, protect your peace πŸ’œπŸ”


🫢 AUTHOR 🫢

Paul Evans <leonerd@leonerd.org.uk>


and that's the whole page, bestie β€” no cap, every last detail accounted for πŸ“

this little rewrite was born from perl v5.36.0, dated 2022-09-10, and it lives in the Net::A...Server(3pm) corner of the User Contributed Perl Documentation section. mwah πŸ’‹ go forth and serve those Tangence clients πŸ’–βœ¨πŸŽ€

πŸ“¦ where this page comes from