Hosting a WebSocket Server on Local

Hi everyone,

I wanted to share some exciting news — OpenAI recently released its first API that allows live chat, and it opens up amazing possibilities for WordPress integration. However, there’s a challenge: client-side connections (i.e., JS on the front end) directly to OpenAI come with significant risks, primarily exposing API keys. While it might work for testing purposes, exposing those keys isn’t a sustainable solution.

The answer here is to use a WebSocket proxy hosted on the server-side, enabling secure, real-time communication without exposing sensitive data. I’m not asking specifically about building a WebSocket proxy, but rather about implementing WebSockets as a server on Local.

The idea would be to pick a PHP file in the Local environment, which would then act as a WebSocket server. This would allow us to implement a WebSocket service and call it directly from our local development environment. I know WebSockets work as a client on Local, but enabling them as a server would make all the difference.

This is going to be a critical feature that many will want very soon. I’m the developer behind AI Engine (AI Engine – WordPress plugin | WordPress.org), and I can confidently say this will be one of the most requested features in the near future. While it’s likely that this will become standard in a year or two, having this functionality in Local now would give developers a head start.

Thanks so much for considering this. It would be a game-changer!

Thank you for sharing this @TigrouMeow! I’ve passed it along to the Local Devs.

1 Like

Thank you, guys! If you need any help with this, or use cases, don’t hesitate to ask. I have a large community of users waiting to play with this :slight_smile:

1 Like

Thanks for working in this. I wanted to implement something like it months ago when I saw play.ai but nobody had a clue how to do it. My host is Godaddy, I can send them a support ticket with the suggestion but they will probably be the last to ever do it. I will change hosting providers when one comes available.

Actually, OVH will likely be the last to implement it, I’m pretty sure! :face_with_peeking_eye: But GoDaddy certainly won’t be among the first either.

Being first is crucial in this case, but hosting services don’t realize it. Many of their engineers aren’t power users, so they miss the importance of this feature, seeing it as only mildly interesting, if not outright unnecessary.

AI is evolving fast, and soon everyone will want real-time chatbots to assist their users and customers. The hosting services that implement this first will gain both users and their trust. My AI Engine plugin is ready for this, but I have yet to find a hosting provider with the vision to consider implementing a WebSocket server feature on their side. It’s huge, but they just do not see it. Yet…

1 Like