XF 2.1 Getting started with Node.js and XenForo?

Jaxel

Well-known member
I'm not a server guy. I don't really install things. I'm just a programmer. I would like to write an addon for XenForo that displays a textbox. If someone edits the contents of that textbox, it pushes out the changes to everyone else who is viewing that textbox... probably through websockets.

Naturally, this description is simplistic. The things I want to do with this are more complicated, but this is a starting point. Does anyone know where to get started on doing something like this? Is Node.js the recommended solution for something like this? How would I install Node.js and run it in XenForo?
 
If you're not a server guy I recommend you to look at something like Firebase for realtime / serverless stuff.
 
No, not at all. Firebase can replace the common functionality that you're probably looking for in NodeJS with the difference that you don't need to configure a server to start using it because it's all in the cloud and offered as a service.

You have: Authentication, two real time NoSQL databases, both have SDKs available to the client side which makes it easy to access the database and use the realtime and offline features very straightforward. They also offer SDKs for server side languages (there's actually a PHP SDK which makes it so easy to access the Firestore database) which are nice if you need to access those resources from outside of Firebase.

Since you're looking for realtime features, my guess is you need to play with the Javascript SDK. One of the challenges that you'll have is authentication. The Javascript SDK needs an authentication object to allow you to read the database and you'd have to find a way integrate it with XenForo, if that's your goal.
 
If this is going to be part of an add-on, then Firebase and Node.js are probably not great ideas as you'd probably want stuff to be hosted by the user, not centrally by you. Something like Ratchet may be suitable, WebSockets within PHP.
 
It's a personal addon, so everything will be kept on my own server.

Authentication I'll be doing through XenForo, so thats not an issue.
 
For node, this is literally what socket.io was written to handle, minus the collaborative algorithm of your choice. Many other platforms have this sort of thing built in as well - Rails, Phoenix (Elixir), etc. The platform is somewhat immaterial.

I don't even run my webchat <-> Discord integrations as the same users my websites run on. Even if it were, they wouldn't be 'inside SMF/Elkarte/Xenforo' - they do not have any awareness of your forum software's context and you will need to pull that in in one form or another.
 
I decided to go with Google Firebase. It has been extremely easy to use after installing the PHP sdk with Composer.
 
Back
Top Bottom