PHP
EN
AI’s “streaming text” UIs: a how-to
[]
phpied.com
You've seen some of these UIs as of recent AI tools that stream text, right?
It's not impossible though, it worked for me with a local PHP server (like $ php -S localhost:8000 ) and I'm pretty sure it used to work on Dreamhost before they switched to FastCGI.
When event: is omitted, it's assumed to be event: message .
SSE requires a (however simple) format of "event:" and "data:" where data can be JSON-encoded or however you wish.
And the demos one more time:Small update: honorable mention for Web SocketsWeb Sockets are yet another alternative to streaming content.
['streaming'
'howto'
'event'
'client'
'uis'
'server'
'ais'
'events'
'data'
'xhr'
'word'
'text'
'php'
'message'
'flush']