@rip-lang/server 1.3.44 → 1.3.46
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +2 -2
- package/server.rip +2 -5
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rip-lang/server",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.46",
|
|
4
4
|
"description": "Pure Rip web framework and application server",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "api.rip",
|
|
@@ -45,7 +45,7 @@
|
|
|
45
45
|
"author": "Steve Shreeve <steve.shreeve@gmail.com>",
|
|
46
46
|
"license": "MIT",
|
|
47
47
|
"dependencies": {
|
|
48
|
-
"rip-lang": ">=3.13.
|
|
48
|
+
"rip-lang": ">=3.13.63"
|
|
49
49
|
},
|
|
50
50
|
"files": [
|
|
51
51
|
"api.rip",
|
package/server.rip
CHANGED
|
@@ -832,7 +832,7 @@ class Server
|
|
|
832
832
|
if path.endsWith('/watch')
|
|
833
833
|
watchPrefix = path.slice(0, -6) # strip '/watch'
|
|
834
834
|
if @watchGroups.has(watchPrefix)
|
|
835
|
-
return @handleWatch(watchPrefix
|
|
835
|
+
return @handleWatch(watchPrefix)
|
|
836
836
|
else
|
|
837
837
|
return new Response('', { status: 503, headers: { 'Retry-After': '2' } })
|
|
838
838
|
|
|
@@ -883,11 +883,9 @@ class Server
|
|
|
883
883
|
return if @watchGroups.has(prefix)
|
|
884
884
|
@watchGroups.set prefix, { sseClients: new Set() }
|
|
885
885
|
|
|
886
|
-
handleWatch: (prefix
|
|
886
|
+
handleWatch: (prefix) ->
|
|
887
887
|
group = @watchGroups.get(prefix)
|
|
888
888
|
return new Response('not-found', { status: 404 }) unless group
|
|
889
|
-
ua = req?.headers?.get('user-agent') or 'unknown'
|
|
890
|
-
console.log "rip-server: SSE connect from: #{ua}"
|
|
891
889
|
encoder = new TextEncoder()
|
|
892
890
|
client = null
|
|
893
891
|
new Response new ReadableStream(
|
|
@@ -910,7 +908,6 @@ class Server
|
|
|
910
908
|
group = @watchGroups.get(prefix)
|
|
911
909
|
return unless group
|
|
912
910
|
dead = []
|
|
913
|
-
console.log "rip-server: broadcast #{type} to #{group.sseClients.size} clients"
|
|
914
911
|
for client as group.sseClients
|
|
915
912
|
try client.send(type)
|
|
916
913
|
catch then dead.push(client)
|