Socket cluster implementation for Vuejs 2 leveraging uws
Install
npm install vue-socket-cluster --save
Usage
Configuration
;Vue
On Vuejs instance usage
add a property connection_name+Events
to listen to connection events
var vm =echoEvents:{console}{console}// Other default events such as ['error','connect','disconnect','connectAbort','connecting', ...] as written on the documentation{//An error occurred on the connection name echo}{}// ...// for hyphen separated events such as 'custom-error' use ...{}methods://triggerInstance object = ```connection_name+Client```{this$echoClient;}
Remove existing listener on client
delete this$options$echoClientevent_name;
Alternative Usage
<!--every connection gets a dynamic component use <[client-name]-client></[client-name]-client> -->
default events
<!-- bind documented events using :on['Event_name'] first letter being a capital letter -->
sending data
<!-- send data by changing the data property -->
event data
<!-- set the event attribute to the event name -->
subscriptions
<!-- set the channel attribute to the channel name -->
Based on works from MetinSeylan/Vue-Socket.io and its contributor