hyperstack-org / hyperstack-org/hyperstack

Hotloader needs special treatment for gitpod

Offen
#202 0 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen
Gitpod integration
Vorherrschende Sprache
JavaScript
Sterne
538
Forks
41
PR-Merge-Kennzahlen
Keine gemergten PRs in 30 T.

Beschreibung

This works:

```ruby
module Hyperstack
class Hotloader
def connect_to_websocket(port)
if `window.location.host` =~ /\d+-([a-f0-9\-]+\..+\.gitpod.io)/
ws_url = "#{port}-#{$1}"
else
host = `window.location.host`.sub(/:\d+/, '')
host = '127.0.0.1' if host == ''
ws_url = "#{host}"
end
puts "Hot-Reloader connecting to #{ws_url}"
protocol = `window.location.protocol` == 'https:' ? 'wss:' : 'ws:'
ws = `new WebSocket(#{protocol} + '//' + #{ws_url})`
`#{ws}.onmessage = #{lambda { |e| reload(e) }}`
`setInterval(function() { #{ws}.send('') }, 10000)` if @ping
end
end
end
```
maybe put the gitpod on some configuration switch

Beitragsleitfaden

Beitragsleitfaden öffnen

Bewertung

Dieses Issue wurde noch nicht bewertet.

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.