imgur / incus Goto Github PK
View Code? Open in Web Editor NEWincus is a middleware for distributing messages via websockets, long polling, and push notifications
License: MIT License
incus is a middleware for distributing messages via websockets, long polling, and push notifications
License: MIT License
Is there a recommended way of updating the docker image (on my end) I have not used it very much so no idea how I can follow the latest release from Incus
We are looking into using incus, it looks really nice, but I couldn't get it to work with Docker. I am not experienced with it but the incus image could not connect to the redis image. I followed all the commands in the readme and both downloaded and 'work' apart from the connecting part.
See https://gist.github.com/AdriVanHoudt/b71c181a00289fbd9fbf
I would like to add support for AlertDictionary and more keys from the Payload that is used now. Any thoughts on how to handle this? Use one of them based on keys used or a key we add to the command (probably the best way) or ...
I can do a PR right away
Currently I am getting these errors:
2015/11/26 16:41:26 Alert (iOS): {"aps":{"alert":"Test: 馃挰test","badge":-1,"sound":"bingbong.aiff"},"payload":{"event":"notification","data":{"message_text":"Test: 馃挰 test","notification":{"body":"馃挰 test","id":121,"image":"urlToImage","tag":121,"title":"Test"}},"time":1448556086}}
2015/11/26 16:41:26 Error (iOS): encoding/hex: invalid byte: U+0074 't'
I add them in javascript like this: '\uD83D\uDCAC'
EDIT: adding like 馃挰
in js does not help
We should error if user is not set on pushormessage call
info
, debug
, warn
, etc.
Right now when getting push notifications we use LPOP and poll; BLOP would be more efficient
I am trying to get this working with websockets but sometimes during testing when reloading my webpage this happens
2015/08/31 10:17:18 Error: websocket: close 1001
panic: runtime error: invalid memory address or nil pointer dereference
[signal 0xb code=0x1 addr=0x68 pc=0x45e034]
goroutine 21 [running]:
github.com/Imgur/incus.(*RedisStore).MarkInactive(0x0, 0xc20800ada0, 0x5, 0xc20800b0a8, 0x1, 0x0, 0x0)
/go/src/github.com/Imgur/incus/redis_store.go:211 +0x144
github.com/Imgur/incus.(*Socket).Close(0xc208010310, 0x0, 0x0)
/go/src/github.com/Imgur/incus/sockets.go:85 +0x111
created by github.com/Imgur/incus.(*Socket).listenForMessages
/go/src/github.com/Imgur/incus/sockets.go:147 +0x1df
goroutine 1 [IO wait, 2 minutes]:
net.(*pollDesc).Wait(0xc208010610, 0x72, 0x0, 0x0)
/usr/src/go/src/net/fd_poll_runtime.go:84 +0x47
net.(*pollDesc).WaitRead(0xc208010610, 0x0, 0x0)
/usr/src/go/src/net/fd_poll_runtime.go:89 +0x43
net.(*netFD).accept(0xc2080105b0, 0x0, 0x7f18e9c1abb0, 0xc20800ab30)
/usr/src/go/src/net/fd_unix.go:419 +0x40b
net.(*TCPListener).AcceptTCP(0xc208038040, 0x482bce, 0x0, 0x0)
/usr/src/go/src/net/tcpsock_posix.go:234 +0x4e
net/http.tcpKeepAliveListener.Accept(0xc208038040, 0x0, 0x0, 0x0, 0x0)
/usr/src/go/src/net/http/server.go:1976 +0x4c
net/http.(*Server).Serve(0xc20805c360, 0x7f18e9c1c160, 0xc208038040, 0x0, 0x0)
/usr/src/go/src/net/http/server.go:1728 +0x92
net/http.(*Server).ListenAndServe(0xc20805c360, 0x0, 0x0)
/usr/src/go/src/net/http/server.go:1718 +0x154
net/http.ListenAndServe(0xc20800ae60, 0x5, 0x0, 0x0, 0x0, 0x0)
/usr/src/go/src/net/http/server.go:1808 +0xba
main.listenAndServe(0xc20803ac60)
/go/src/github.com/Imgur/incus/incus/main.go:71 +0x166
main.main()
/go/src/github.com/Imgur/incus/incus/main.go:66 +0x51e
goroutine 5 [syscall, 8 minutes]:
os/signal.loop()
/usr/src/go/src/os/signal/signal_unix.go:21 +0x1f
created by os/signal.init路1
/usr/src/go/src/os/signal/signal_unix.go:27 +0x35
goroutine 6 [chan send, 2 minutes]:
github.com/Imgur/incus.func路015()
/go/src/github.com/Imgur/incus/sockets.go:25 +0x13a
created by github.com/Imgur/incus.init路1
/go/src/github.com/Imgur/incus/sockets.go:27 +0x5c
goroutine 7 [chan receive, 8 minutes]:
main.func路002()
/go/src/github.com/Imgur/incus/incus/main.go:92 +0x198
created by main.InstallSignalHandlers
/go/src/github.com/Imgur/incus/incus/main.go:103 +0x25
goroutine 8 [sleep]:
github.com/Imgur/incus.(*Server).RecordStats(0xc208040460, 0x3b9aca00)
/go/src/github.com/Imgur/incus/server.go:301 +0x5f
created by main.main
/go/src/github.com/Imgur/incus/incus/main.go:57 +0x430
goroutine 9 [sleep]:
github.com/Imgur/incus.(*Server).LogConnectedClientsPeriodically(0xc208040460, 0x4a817c800)
/go/src/github.com/Imgur/incus/server.go:308 +0xff
created by main.main
/go/src/github.com/Imgur/incus/incus/main.go:58 +0x459
goroutine 20 [select, 2 minutes]:
github.com/Imgur/incus.(*Socket).listenForWrites(0xc208010310)
/go/src/github.com/Imgur/incus/sockets.go:163 +0x736
created by github.com/Imgur/incus.func路011
/go/src/github.com/Imgur/incus/server.go:131 +0x9a4
goroutine 14 [sleep]:
github.com/Imgur/incus.(*Server).SendHeartbeatsPeriodically(0xc208040460, 0x4a817c800)
/go/src/github.com/Imgur/incus/server.go:280 +0x36
created by main.main
/go/src/github.com/Imgur/incus/incus/main.go:63 +0x4ea
goroutine 18 [select, 2 minutes]:
github.com/Imgur/incus.func路011(0x7f18e9c1c340, 0xc208044320, 0xc208032680)
/go/src/github.com/Imgur/incus/server.go:133 +0xb4e
net/http.HandlerFunc.ServeHTTP(0xc20800af00, 0x7f18e9c1c340, 0xc208044320, 0xc208032680)
/usr/src/go/src/net/http/server.go:1265 +0x41
net/http.(*ServeMux).ServeHTTP(0xc20803a6c0, 0x7f18e9c1c340, 0xc208044320, 0xc208032680)
/usr/src/go/src/net/http/server.go:1541 +0x17d
net/http.serverHandler.ServeHTTP(0xc20805c360, 0x7f18e9c1c340, 0xc208044320, 0xc208032680)
/usr/src/go/src/net/http/server.go:1703 +0x19a
net/http.(*conn).serve(0xc208044000)
/usr/src/go/src/net/http/server.go:1204 +0xb57
created by net/http.(*Server).Serve
/usr/src/go/src/net/http/server.go:1751 +0x35e
When commands are received for a client that is longpolling, then we need to buffer commands that arrive between when the message is sent to the longpoller, and when they reconnect. For example,
t=0, A connects via longpoll
t=100, message is received by A's long poller, and A's long poller disconnects
t=101, message is received by Incus for A, but is dropped because there is no client for A
t=102, A connects via longpoll
Instead, we need a threshold (preferably in time-units rather than absolute number of messages) buffer:
t=0, A connects via longpoll.
t=100, message is received by A's long poller, and A's long poller disconnects
t=101, message is received by Incus for A, and is placed into a buffer
t=102, A connects via longpoll, and a pending message is dispatched, and A's long poller disconnects.
t=104, A connects via longpoll.
Should be fairly easy I guess.
See alexjlockwood/gcm#9
I will do a PR to both the gcm module and Incus to allow this option
I am using incusjs to connect to incus on the client side (where you should really do either poll or websocket and not abort the poll when websocket comes through, this leaves Incus thinking there are 2 connections while this is not true if you are open I will do a PR for this)
I am using this command
{
"command": {
"command": "pushormessage",
"user": "user1"
},
"message": {
"time": 0,
"websocket": {
"event": "test",
"data": {...},
"time": 0
}
}
}
And I am doing both (normally only lpush needed right?)
redis.publish('Incus', JSON.stringify(command));
redis.lpush('Incus_Queue', JSON.stringify(command));
but none seem to trigger Incus to use the websocket
A declarative, efficient, and flexible JavaScript library for building user interfaces.
馃枛 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 馃搳馃搱馃帀
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google 鉂わ笍 Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.