mdlayher / edgemax Goto Github PK
View Code? Open in Web Editor NEWPackage edgemax implements a client for Ubiquiti EdgeMAX devices. MIT Licensed.
License: MIT License
Package edgemax implements a client for Ubiquiti EdgeMAX devices. MIT Licensed.
License: MIT License
Hey @mdlayher ๐!
I was looking at setting this up in my local network (again), and ran into an issue. I spent about 30 minutes getting familiar enough with the code to debug, but I haven't looked much further.
It looks like the webocket immediately EOFs after the subscribe call is made in client_stats.go
, and continues to do so forever! Oddly enough, the pings in the other goroutine work fine, so the session token seems valid - but the websocket seems to take a crap.
I did some digging around the wsCodec.Send
call in client_stats.go
and added this janky debugging:
json.NewEncoder(os.Stdout).Encode(sub)
if err := wsCodec.Send(wsc, sub); err != nil {
return nil, nil, err
}
fmt.Println("waiting..")
var out interface{}
fmt.Println(wsCodec.Receive(wsc, &out))
fmt.Println(out)
This just spits out the payload of the subscribe message, and then immediately tries to receive. What I end up getting is this:
"SUBSCRIBE":[{"name":"export"},{"name":"interfaces"},{"name":"system-stats"}],"UNSUBSCRIBE":[],"SESSION_ID":"nibdnjrpsnrfle65su1jon3r2ob6r7hd"}
waiting..
EOF
<nil>
Matching the payload up, it looks identical to my browser (aside from a different session ID of course), so I'm at a bit of a loss as to why it's flipping out. My only guess is that there might be something wrong in the websocket itself, but I've actually not worked with them much, which is why I figured I'd pause and open this issue.
I'm going to keep digging because I'm curious (and I want to write a blog post about monitoring my home network now that I work remotely, this is a part of that!), but I wanted to see if you were having the same issue.
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.