Skip to content
GitLab
About GitLab
GitLab: the DevOps platform
Explore GitLab
Install GitLab
How GitLab compares
Get started
GitLab docs
GitLab Learn
Pricing
Talk to an expert
/
Help
What's new
2
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Switch to GitLab Next
Projects
Groups
Snippets
Sign up now
Login
Sign in / Register
Toggle navigation
Menu
Open sidebar
Lorenzo Setale
twitch-meme-generator
Commits
067c6404
Verified
Commit
067c6404
authored
Apr 03, 2021
by
Lorenzo Setale
Browse files
to avoid increasing websockets channels we encourage to reuse the same browser
source Signed-off-by:
Lorenzo Setale
<
lorenzo@setale.me
>
parent
b66ee4fe
Changes
2
Hide whitespace changes
Inline
Side-by-side
README.md
View file @
067c6404
...
...
@@ -56,13 +56,13 @@ By default this url will be [http://localhost:8000/](http://localhost:8000/).
If you are running on a different platform like Heroku or DigitalOcean please
use the URL provided by those platforms.
Remember to
ena
ble the following options:
Remember to
have di
ble
d
the following options:
-
Refresh browser when scene becomes active
-
Shutdown source when not visible
The reason is this that this uses WebSockets and it is better to no have
_multiple listners_
at the same time (aka: reuse the same source by
_Copy Reference_
)
_Copy Reference_
)
. In case of issues the web page should reconnect automagically
### Adding files
You can add files any time into the
`assets`
directory (please note that the
...
...
http/channels.go
View file @
067c6404
package
http
import
(
log
"github.com/sirupsen/logrus"
)
var
(
WSListnerChannels
[]
chan
string
)
...
...
@@ -9,7 +13,18 @@ var (
// This allows to have multiple browser source connecting on different
// web sockets at the same time.
func
channelPipe
(
mainChannel
chan
string
)
{
logWF
:=
log
.
WithFields
(
log
.
Fields
{
"f"
:
"http.channelPipe"
,
})
logWF
.
Debug
(
"Starting the Channel Pipe"
)
for
msg
:=
range
mainChannel
{
log
.
WithFields
(
log
.
Fields
{
"msg"
:
msg
,
"channels"
:
len
(
WSListnerChannels
),
})
.
Debug
(
"Sending messages to web socket channels"
)
for
_
,
ch
:=
range
WSListnerChannels
{
ch
<-
msg
}
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment