Title: Websocket in WordPress
Last modified: March 7, 2021

---

# Websocket in WordPress

 *  [ersito](https://wordpress.org/support/users/ersito/)
 * (@ersito)
 * [5 years, 3 months ago](https://wordpress.org/support/topic/websocket-in-wordpress/)
 * Hello, there. I’m creating a custom functionality for a board game in my functions.
   php
    I enqued a .js file and I’m using some AJAX.
 * However, I need my custome page to be real time updated for all the users (5 
   or 6) viewing it. Websockets seem the way to go, but I can not find any documentation
   on how to implement them in WordPress.
    Can anyone advice me or address me to
   a tutorial?
 * Thanks

Viewing 5 replies - 1 through 5 (of 5 total)

 *  [Joy](https://wordpress.org/support/users/joyously/)
 * (@joyously)
 * [5 years, 3 months ago](https://wordpress.org/support/topic/websocket-in-wordpress/#post-14146381)
 * Make your game a plugin instead of just in your theme. Plugins have much more
   control over loading and they are loaded before themes.
    [Plugin Developer Handbook](https://developer.wordpress.org/plugins/)
 *  Moderator [bcworkz](https://wordpress.org/support/users/bcworkz/)
 * (@bcworkz)
 * [5 years, 3 months ago](https://wordpress.org/support/topic/websocket-in-wordpress/#post-14146786)
 * Client side websockets are implemented in JavaScript. You’d enqueue the script
   like any other JavaScript. For the socket server, if it’s time critical, I’d 
   avoid going through WP. Install a separate app to handle websocket traffic.
 *  Thread Starter [ersito](https://wordpress.org/support/users/ersito/)
 * (@ersito)
 * [5 years, 3 months ago](https://wordpress.org/support/topic/websocket-in-wordpress/#post-14149077)
 * Thanks a lot bcworkz!!
 * Any recommendation on what library to use? (as you can guess, I’m an amateur 
   programmer)
 * Thanks Joy, too. I’ll look into making it a plugin
 *  Moderator [bcworkz](https://wordpress.org/support/users/bcworkz/)
 * (@bcworkz)
 * [5 years, 3 months ago](https://wordpress.org/support/topic/websocket-in-wordpress/#post-14151342)
 * I’ve not used web workers myself. The functionality should be built into modern
   browsers, no library needed. You just need to verify browser support. `if ( window.
   WebSocket )`. Server side code can be [almost anything you want](https://developer.mozilla.org/en-US/docs/Web/API/WebSockets_API/Writing_WebSocket_servers).
   I imagine there are server libraries available, but they will include some inherent
   overhead. For optimal speed you’d be better off with your own lean and mean custom
   code. Avoid interpreted languages if you can. Compiled code like C++ will run
   faster.
 *  Thread Starter [ersito](https://wordpress.org/support/users/ersito/)
 * (@ersito)
 * [5 years, 3 months ago](https://wordpress.org/support/topic/websocket-in-wordpress/#post-14154310)
 * Thank you!!

Viewing 5 replies - 1 through 5 (of 5 total)

The topic ‘Websocket in WordPress’ is closed to new replies.

 * In: [Developing with WordPress](https://wordpress.org/support/forum/wp-advanced/)
 * 5 replies
 * 3 participants
 * Last reply from: [ersito](https://wordpress.org/support/users/ersito/)
 * Last activity: [5 years, 3 months ago](https://wordpress.org/support/topic/websocket-in-wordpress/#post-14154310)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
