a4-socket-io
Angular 7 socket.io client
How-To
Install
npm install a4-socket-io
SocketController decorator
url
specifies where should the client connect to the socket.io server.
socket.component.ts
...;...
OnSocketEvent
messagedata: string
If eventName
is specified, the socket service will use the specified event name otherwise, it will use the method name (ie. message
) as the event name.
OnConnect
connect
OnDisconnect
disconnect
Inject Socket Service
constructorprivate socket: SocketService
Emit data to the socket.io server
... this.socket.emit'eventName', data; ...