Hmmm....weird. My code was visible in preview. I did not look at the final
result after posting. Maybe I should not have used the  tag.

| server client |
server := ZnWebSocket startServerOn: 1701 do: [ :webSocket |
        [ webSocket runWith: [ :message | self crLog: 'Received message: ', 
message
printString ] ]
        on: ConnectionClosed, PrimitiveFailed do: [ "ignore close" ].
        self crLog: 'The server is closed' ].
client := ZnWebSocket to: (ZnUrl fromString: 'ws://localhost:1701').
[
        [ client runWith: [ :message | "ignore received messages" ] ]
        on: ConnectionClosed, PrimitiveFailed do: [ "ignore close" ].
        self crLog: 'The client is closed'.
        server stop ] fork.
(Delay forSeconds: 1) wait.
client sendMessage: 'Hello world'.
client close.
"Workaround: use the following instead of 'client close'.
client sendFrame: ZnWebSocketFrame close."




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

Reply via email to