Search docs/
Getting StartedPlugins

WebSocket Server

This plugin allows you to run a single, lightweight, barebone WebSocket Server.

Stuck on a Cordova issue?

If you're building a serious project, you can't afford to spend hours troubleshooting. Ionic’s experts offer premium advisory services for both community plugins and premier plugins.

Contact Us Today!


npm install cordova-plugin-websocket-servernpm install @ionic-native/web-socket-serverionic cap syncionic cordova plugin add cordova-plugin-websocket-servernpm install @ionic-native/web-socket-server
Ionic Enterprise comes with fully supported and maintained plugins from the Ionic Team. Learn More or if you're interested in an enterprise version of this plugin Contact Us

Supported Platforms

  • Android
  • iOS



See here.


import { WebSocketServer } from '@ionic-native/web-socket-server';

constructor(private wsserver: WebSocketServer) { }


// start websocket server
this.wsserver.start(8888, {}).subscribe({
  next: server => console.log(`Listening on ${server.addr}:${server.port}`),
  error: error => console.log(`Unexpected error`, error);

// watch for any messages
this.wsserver.watchMessage().subscribe(result => {
  console.log(`Received message ${result.msg} from ${result.conn.uuid}`);

// send message to connection with specified uuid
this.wsserver.send({ uuid: '8e7c4f48-de68-4b6f-8fca-1067a353968d' }, 'Hello World');

// stop websocket server
this.wsserver.stop().then(server => {
  console.log(`Stop listening on ${server.addr}:${server.port}`);