working fine, no bugs
cleaned code
refactored socketsInit and how it handles the ready object, delays 100ms to avoid pushing/send issue when socket is closed abruptly
refactored the observer names to add a suffix be more clear like <listening> for sockets and <inbound> and <outbound> for consumers
add better examples two consumers and socket example and duplex example
processing.js
add ready command to consumer for pushes
emitting entire packet
base.js
added ready all subcriber that sends/push when ready
adds ready packet to conPackets for all s socket types
change observer names to include sufixes :socket, :consumer, :process, :device
add method to easily create an observer of connecting consumer(s)
processing.js
added default ready command for socket
removed arrow functions from socket cmd functions must Always be regular functions for setting context
base.js
better validation and defaults for options to registerSocket
add by default a ready observer for when socket starts listening
base:
add ready observer class instance
adds a ready observer for each consumer (only) registered
refactored default namespace processing a bit
refactored _packetProcess the default/main processor
now can register before,command, and after processors
uses a single _process function to remove near reptition
does a better job of maintaining/merging the packet from step to step
processing:
change processor to cmdProcessor
refactor default consumer processing
refactor init to socketsInit support old init
registerSocket now only registers a socket it does not initialize, addSocket now calls this for backwards compatibility
added active getter to all sockets/consumers so now ready getter returns complete active state of all sockets
socketsInit only attempts to init non active sockets so can be called multiple times
add some more helpers
getSocketsFilter, getConsumers, getSocketInit
push now supports push to specific sockets/servers instead of just all which is the default
will now emit 'error', 'warn', 'fatal' when needed so instance can track and track easier and take action (like notification)
sockets will bubble these up now.
refactored amend methods
added transport validation
changed default name spaces to all start with _ to avoid accidential namespace issues
refactored examples to showcase all possibilities with a four in one (fio) example
refactored ha hooks
added matching websocket client
all works changes made by one socket are pushed to all sockets where they do their updates including home assistant
added a home assistant package file including lovelace yaml for matching HA interface.
changed default commands handling, removed _default namespace
changed s and c name spaces to use ._c, and _s as default name spaces
amend commands work with above ._c and ._s props
changed .socket to ._socket to avoid namespace issues with instances using .socket. Instances should use the getSocket method!
copied host and port options to connect. for mqtt socket to make setting those more standard
cleaned up logging
Add hooking for before send, and before and after process
Improved/cleaned preempting default processing
by default removed root namespace checking must now set useRootNS to true to access command functions there. This to avoid issuess like an 'on' function clashing with an emitter listerner.
send now transport send now process as many consumer sockets as have been created by pushing them onto array and the using promise.all and map to send out together.
Return for one than one is an array of responses.
getPacketByName was added to make it easy to grab just one of those in returned array.
improved socket packet processing call now binds this and name of socket that received packet for processing
single common processor for all packets incoming (either consumer or socket)
default processing splits into socket or consumer
default processing has calls looking for packet cmd functions before returning error packet
1. Added Namespace // TODO
2. A Pariticular Sockect
3. Root of instance
4. The socket type and transport //TODO
5. The socket type
there are helper functions for adding cmd functions to any of these save the root instance we you can add directly.