Hello Attila,

What I want is to have a Teapot Server running that somehow also can handle
websockets :)

In the Pharo Enterprise Book there is a chapter about WebSockets.
In there are examples how to setup a ZnServer with a ZnWebSocketDelegate,
for instance:

ZnServer stopDefault.
ZnServer startDefaultOn: 1701.
ZnServer default logToTranscript.
ZnServer default delegate
   map: 'ws-echo-client'
   to: [ :request | ZnResponse ok: (ZnEntity html: ZnWebSocketEchoHandler
clientHtml) ];
   map: 'ws-echo'
   to: (ZnWebSocketDelegate map: 'ws-echo' to: ZnWebSocketEchoHandler new).

I think it would be nice if this translates to:

Teapot on
        GET: '/ws-echo-client' -> ZnWebSocketEchoHandler clientHtml;
        WS: '/ws-echo' -> [: webSocket | ZnWebSocketEchoHandler new value:
webSocket];
        start.

But I do not know if this is correct syntax. (Is WS a correct Method? , does
it fit next to GET / PUT / POST etc ?)

Or is it better to do something like:

teapot := Teapot on.
teapot GET: '/ws-echo-client' -> ZnWebSocketEchoHandler clientHtml.
teapot server delegate map:  'ws-echo'
   to: (ZnWebSocketDelegate map: 'ws-echo' to: ZnWebSocketEchoHandler new).
teapot start.


I hope this makes it a bit more clear :)



--
Sent from: http://forum.world.st/Pharo-Smalltalk-Users-f1310670.html

Reply via email to