Skip to content

Commit

Permalink
just some code style corrections
Browse files Browse the repository at this point in the history
  • Loading branch information
jbrichau committed Jul 23, 2024
1 parent f305106 commit 944f3e1
Show file tree
Hide file tree
Showing 22 changed files with 29 additions and 13 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
initialization
initializeWithRequestContext: aRequestContext

self initialize.
session := aRequestContext session.
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
testing
isConnected

self subclassResponsibility
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
callbacks
onClose: aBlock

onClose := aBlock
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
callbacks
onError: aOneArgumentBlock

onError := aOneArgumentBlock

Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
callbacks
onMessage: aOneArgumentBlock

onMessage := aOneArgumentBlock
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
running
run
"Run the WebSocket's input process."

self subclassResponsibility
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
callbacks
send: aString
"Write data to the socket"

self subclassResponsibility
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
private
touchSession
"Prevent session expiry."

session ifNotNil: [ :s |
Transcript show:'Touch session ', s key;cr.
s application cache at: s key ifAbsent:[ ] ]
Original file line number Diff line number Diff line change
@@ -1 +1 @@
SystemOrganization addCategory: #'Seaside-WebSocket-Core'!
self packageOrganizer ensurePackage: #'Seaside-WebSocket-Core' withTags: #()!
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
initialization
class initialization
initialize
| application |
application := WAAdmin register: self asApplicationAt: 'examples/websockets/counter'.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
actions
decrease

self model decrease.
self update: #decrease
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
actions
increase

self model increase.
self update: #increase
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
accessing
pusher

^ self class pusher
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
rendering
renderContentOn: html

html heading
id: #count;
with: self model count.

html paragraph: [
html anchor
onClick: (html jQuery ajax
callback: [ self decrease ]);
onClick: (html jQuery ajax callback: [ self decrease ]);
with: 'dec'.
html space; space; space.
html anchor
onClick: (html jQuery ajax
callback: [ self increase ]);
onClick: (html jQuery ajax callback: [ self increase ]);
with: 'inc' ].

html document
addLoadScript: (html websocket
pusher: self pusher)
addLoadScript: (html websocket pusher: self pusher)
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
updating
update: anAspect
"Update the number in all connected web browser. Only the first 3 lines are really needed, the rest adds some eye-candy and can simply be removed if not needed."
"Update the counter in all connected web browsers.
Only the first 3 lines are really needed, the rest adds some eye-candy and can simply be removed if not needed."

self pusher javascript: [ :script |
script << (script jQuery: #count)
Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1 @@
SystemOrganization addCategory: #'Seaside-WebSocket-Examples'!
self packageOrganizer ensurePackage: #'Seaside-WebSocket-Examples' withTags: #()!
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
initialization
initializeWith: aZnWebSocket

self initialize.
onClose := [ Transcript show: 'closing...' ].
znWebSocket := aZnWebSocket
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
testing
isConnected

^ znWebSocket isConnected
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
running
run

[ znWebSocket runWith: [ :message | self touchSession. onMessage value: message ] ]
on: ConnectionClosed
do: [ :e | onClose ifNotNil:[ onClose cull: e ] ]
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
instructions
callbacks
send: aString

self isConnected ifFalse: [ ^ self ].

self touchSession.
znWebSocket sendMessage: aString
Original file line number Diff line number Diff line change
@@ -1 +1 @@
SystemOrganization addCategory: #'Seaside-WebSocket-Zinc'!
self packageOrganizer ensurePackage: #'Seaside-WebSocket-Zinc' withTags: #()!
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
converting
websocketResponseFrom: aRequestContext

| wsdelegate webSocket |
wsdelegate := (ZnSeasideWebSocketDelegate new handler: [ :ws | webSocket ifNotNil:[ :wasocket | wasocket znWebSocket: ws ] ]).
((aRequestContext request isWebSocketSetupRequest) and: [ aRequestContext webSocket notNil ])
Expand Down

0 comments on commit 944f3e1

Please sign in to comment.