Loading...
 
Skip to main content

History: Realtime

Source of version: 15

Copy to clipboard
            ! {{page}}
New in ((Tiki25)). Use built-in websockets server within Tiki to enable realtime communication features of the app.

At first for ((Tiki Manager Package)), but will later be added to other Tiki Features.

Powered by https://packagist.org/packages/cboden/Ratchet and https://reactphp.org

This will require a special server configuration (possibly root access). ((Server Check|tiki-check.php)) will indicate if server is correctly set up.

Initial commit: https://gitlab.com/tikiwiki/tiki/-/merge_requests/1638

In this documentation, we are going to configure Virtualmin (but any other server can be used), and then we will check if it worked.

!! Configuration
!!! Requirements
We already have a Tiki instance up and running, on Virtualmin, now we need to take into account a few more things: __Proxy Settings__, __Realtime Service__, __proxy_wstunnel__, __Realtime__ feature, and __Realtime port__ in Tiki in order to get Realtime working.

!!!! 1. Proxy Settings
First, let us edit Apache directives and add the ProxyPass and the ProxyPassReverse settings in the SSl virtual host. We make both point to ''/ws ws://localhost:8080/''
To do this, we go to ''__Virtualmin __''-> ''__Services __''-> ''__Configure SSL Website__'' -> ''__Edit Directives__''.
In the text box that opens, we add -+ProxyPass /ws ws://localhost:8080/+- and -+ProxyPassReverse /ws ws://localhost:8080/+- at the end, like shown in the picture below:

{img src="display1879" link="display1879" width="700" rel="box[g]" imalign="center" desc="Click to expand" align="center" styleimage="border"}
!!! 2. Realtime Service
At this step, we need to create a Systemd service to start the WS server.
N.B: Start the WS server with the same user that Tiki web requests run as (to avoid permission issues) - e.g. -+sudo -u www-data php tiki-realtime.php+-
The process is simple. Just go to ''__Webmin __''-> ''__System __''-> ''__Bootup and Shutdown__'' -> ''__create a new systemd service__''.

{img src="display1880" link="display1880" width="700" rel="box[g]" imalign="center" desc="Click to expand" align="center" styleimage="border"}

In the opening form, we fill in the __Service name__, the __service description__, and the __commands to run on startup__. As we don't need to shut this down, we are going to leave empty the "Commands to run on shutdown" field, check __Yes __for Start at boot time option, and click __create__.
__The command to run on startup__ is: -+sudo -u user PHP -d session.save_path=/home/user/tmp /home/user/public_html/tiki-realtime.php+-
Replace user with your user

{img src="display1883" link="display1883" width="700" rel="box[g]" imalign="center" desc="Click to expand" align="center" styleimage="border"}

After this, you can check the content of your system service, and it should look something similar to the image below:

{img src="display1882" link="display1882" width="700" rel="box[g]" imalign="center" desc="Click to expand" align="center" styleimage="border"}

!!!! 3. The proxy_wstunnel
The last step here in Virtualmin is to make sure the proxy_wstunnel module is enabled.
To do this, go to ''__Webmin __''-> ''__Servers __''-> ''__Apache Webserver__'' -> ''__Global configuration__'' -> ''__Configure Apache Modules__'', and check the __proxy_wstunnel__ module checkbox, like in the figure below:

{img src="display1884" link="display1884" width="700" rel="box[g]" imalign="center" desc="Click to expand" align="center" styleimage="border"}

!!!! 4. Realtime feature
At this step, we need to enable Realtime feature in Tiki. When not enabled, this feature is visible only upon search.
Under ''__Settings__'' -> ''__Control Panels__'', in the "''Search preferences''" search box, type a keyword, ''"realtime"'', for example.

{img src="display1885" link="display1885" width="700" rel="box[g]" imalign="center" desc="Click to expand" align="center" styleimage="border"}

!!!! 5. The Realtime port
Let's note that this not required, but it is an interesting preference and usefull in some cases (default port is not available), because it allows you to set the port on which the server will be listening to. 8080 is the port number by default...

{img src="display1945" link="display1945" width="700" rel="box[g]" imalign="center" desc="Click to expand" align="center" styleimage="border"}

Let's note also that Tiki Realtime can also be started from CLI by running, from the project root, the command __''php tiki-realtime.php''__, and, here too, the port can be specified by adding a port parameter to the command: __''php tiki-realtime.php -p 8843''__ which means port number will be set to __8843__.


After this is done, Tiki Realtime should be well set up and working. There is a way to check that. So let's see if everything went well...

!! Check that Realtime is working
This task is as simple as opening our Tiki and running "__Server Check__"
To do this you need to go under ''__Settings__'' -> ''__Control Panels__'' -> ''__Global Setup__'' -> ''__General Settings__'' and find ''__"Server Fitness"__'', click on it, and on the page that opens, scroll down until you find the ''__"Tiki Realtime"__'' section. If Tiki Realtime is working, all the requirements status should be "Good" as shown in the image below:

{img src="display1947" link="display1947" width="700" rel="box[g]" imalign="center" desc="Click to expand" align="center" styleimage="border"}
        

History

Advanced
Information Version
Josue Zirimwabagabo 22
Marc Laporte Making it clear it's optional 21
Marc Laporte Link to page 20
Marc Laporte 19
Marc Laporte 18
Marc Laporte 17
Josue Zirimwabagabo 16
Josue Zirimwabagabo 15
Josue Zirimwabagabo 14
Josue Zirimwabagabo 13
Josue Zirimwabagabo Fix typos 12
Adrien 11
Adrien 10
Josue Zirimwabagabo 9
Josue Zirimwabagabo 8
Josue Zirimwabagabo 7
Josue Zirimwabagabo 6
Josue Zirimwabagabo 5
Marc Laporte 4
Marc Laporte 3
Marc Laporte 2
Marc Laporte 1