[TYPO3-english] TYPO3 and Websockets

Stephan Schuler Stephan.Schuler at netlogix.de
Tue Mar 12 10:19:49 CET 2013

Hash: SHA256

Hey Viktor.

I would go eID, too.

According to the page "Process Flow" on the Ratchet site [1], I would think the default webpage creates a dedicated websocket instance for each user who wants to interact with the webserver. This means you don't care about having multiple fe_users in one websocket process, you don't need to encapsulate session data and stuff like that.

So as suggested, I would create an eID script which connects to the TSFE and fe_user by default TYPO3 tslib_eidtools. This eID script can configure and run the Ratchet instance. As soon as the user reconnects to the Ratchet instance, the TYPO3 environment should be in place.

You could try a bit and tell me, if this is kind of the thing I might want on my webserver. Currently I don't think, because TYPO3 sometimes consumes lots of memory. My servers are configured to stop spawning new PHP processes as soon as there are so many of them that, multiplied with the configured amount of memory by memory_limit, my webserver runs out of memory. This means: The number of PHP processes is limited to a very low number, very often way less then 100. The system relies on fast PHP processes that end after a very short time and free their memory. If I start to have some low-memory processes for lightweight socket connections, this doesn't influence my calculation since I cannot know if a process grows huge or keeps small when it gets spawned. I have to assume all of my processes at some point need the configured maximum memory. So, web sockets on the very same machine then the TYPO3 instance would make me definitively stop sleeping well.

If you think about a single (or a small couple of) web sockets that are initiated by something like startup or CLI and that keep persistently and interact with many different users: I guess there is no way to synchronize this with TYPO3. There is no easy way of having different $GLOBALS[TSFE] objects, which hold the current fe_user. This way, you start to include and manipulate core classes standalone and definitively conflict with core bootstrap.

Having a single web socket for all users is nice for memory but kind of undoable with TYPO3. Having one web socket for each user is nice in terms of encapsulation but terrible when it comes to memory. So, when implemented, please call back and report what happened :).

[1] http://socketo.me/docs/flow

Kind regards,

Stephan Schuler


Telefon: +49 (911) 539909 - 0
E-Mail: Stephan.Schuler at netlogix.de
Website: media.netlogix.de

- --
netlogix GmbH & Co. KG
IT-Services | IT-Training | Media
Andernacher Straße 53 | 90411 Nürnberg
Telefon: +49 (911) 539909 - 0 | Fax: +49 (911) 539909 - 99
E-Mail: info at netlogix.de | Internet: http://www.netlogix.de

netlogix GmbH & Co. KG ist eingetragen am Amtsgericht Nürnberg (HRA 13338)
Persönlich haftende Gesellschafterin: netlogix Verwaltungs GmbH (HRB 20634)
Umsatzsteuer-Identifikationsnummer: DE 233472254
Geschäftsführer: Stefan Buchta, Matthias Schmidt

- -----Ursprüngliche Nachricht-----
Von: typo3-english-bounces at lists.typo3.org [mailto:typo3-english-bounces at lists.typo3.org] Im Auftrag von Marco Behnke
Gesendet: Dienstag, 12. März 2013 08:54
An: TYPO3 English
Cc: typo3-english at googlegroups.com
Betreff: Re: [TYPO3-english] TYPO3 and Websockets

Am 11.03.2013 19:21, schrieb Viktor Livakivskyi:
> Hi, List.
> We're building an application, which requires communication from
> server to client and therefore it was decided to try out Websockets,
> which in theory fulfills our needs best. A basic websocket server,
> that listens to port
> 8080 and communicates with outer world, was created (using Ratchet [1]).
> But here comes a problem, that we can't solve: we need an existing
> $GLOBALS['TSFE']->fe_user object to send personalized messages to a
> user, as well as would be nce to use the power of TYPO3 localization,
> and, probably other features from API. Is there a way to invoke TYPO3
> engine and re-create environment, as if it is usual HTTP request, or
> we need to build initialization from scratch, duplicating index.php
> and index_ts.php of TYPO3?

Can't you dispatch to typo3server with an eID call to get the data needed? The session cookie must be sent with the websocket request and dispatched as well to get the session.

I am not into websockets, this is just an idea.

> [1] http://socketo.me/
> _______________________________________________
> TYPO3-english mailing list
> TYPO3-english at lists.typo3.org
> http://lists.typo3.org/cgi-bin/mailman/listinfo/typo3-english

- --

Marco Behnke
Software Developer Grepolis

InnoGames GmbH
Harburger Schloßstraße 28 (Channel 4) - 21079 Hamburg - Germany Tel +49 40 7889335-0

Managing Directors: Hendrik Klindworth, Eike Klindworth, Michael Zillmer
VAT-ID: DE264068907 Amtsgericht Hamburg, HRB 108973

http://www.innogames.commarco.behnke at innogames.de

TYPO3-english mailing list
TYPO3-english at lists.typo3.org

Version: PGP Universal 3.3.0 (Build 8741)
Charset: utf-8


More information about the TYPO3-english mailing list