summaryrefslogtreecommitdiffhomepage
path: root/WebSockets.hs
Commit message (Collapse)AuthorAge
* Avoid crash when --use-server is given an url that does not include a path.Joey Hess2017-05-09
|
* allow building with versions in debianJoey Hess2017-05-02
| | | | | | When built with old websockets, compression is not supported. Client and server will negotiate that so version skew between them is not a problem.
* add prevEntered pointerJoey Hess2017-05-02
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Client requires this always point to the previous Entered it accepted, so a hash chain of Entered is built up, and there is no possibility for ambiguity about which order a client received two Entered activies in. So restoreHashes now has to try every possible combination of known hashes for both prevEntered and prevActivity. That could be significantly more work, but it would be unusual for there to be a lot of known hashes, so it should be ok. --graphviz shows this additional hash chain with grey edges (and leaves out edges identical to the other hash chain) While testing this with an artifical network lag, it turned out that signature verification was failing for Reject messages sent by the user. Didn't quite figure out what was at the bottom of that, but the Activity Entered that was sent back in a Reject message was clearly not useful, because it probably had both its prevEntered and prevActivity hashes set to Nothing (because restoreHashes didn't restore them, because the original Activity Entered was out of the expected chain). So, switched Rejected to use a Hash. (And renamed Rejected to EnteredRejected to make it more clear what it's rejecting.) Also, added a lastAccepted hash to EnteredRejected. This lets the developer find its way back to the accepted chain when some of its input gets rejected. This commit was sponsored by Trenton Cronholm on Patreon.
* move protocol types to topJoey Hess2017-05-01
|
* add --use-server option for userJoey Hess2017-04-30
|
* add license headers to all source filesJoey Hess2017-04-30
|
* server: email logs to user, and option to delete old onesJoey Hess2017-04-30
|
* fix probable race in use of restoreHashesJoey Hess2017-04-30
| | | | | | | | | | | | | I think there was a race where a SessionKey message had been drained from the TChan, but not yet added to the developer state, which was resonsible for recent instability at startup. It manifested as protocol errors where the prevActivity hash was wrongly Nothing. Fixed by adding a MissingHashes type to tag things whose hashes have been stripped, and adding back the hashes when needed, which always happens inside atomically blocks, so won't have such a race.
* use developer control window to tell when write access is grantedJoey Hess2017-04-29
|
* Leave the prevMessage out of Activity serialization to save BW.Joey Hess2017-04-27
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Do include it in the data that gets signed, so it can be recovered by trying each likely (recently seen) Activity as the prevMessage, and checking the signature. The UserState and DeveloperState already had the necessary state about recently seen hashes, so this does not impact data use. One tricky bit is that relayFromSocket needs to wait for the TMChan to be empty before calling restorePrevActivityHash. Otherwise, the hashes of items in the channel that have not been processed yet won't be tried. The TMChan is not really being used as a channel since only 1 item can be in it. It could be converted to a TMVar, but closeTMChan is used so I left it as a channel. Note that the server does not restore hashes of messages that pass through it; it's just a dumb relay. Sending a single key press now only needs 94 bytes of data to be sent, down from 169! --- Also switched to SHA512, since hashes are no longer being sent over the wire and so the larger size does not matter. SHA512 is slightly faster and more secure. This commit was sponsored by Ewen McNeill.
* switch wire message seralization to use protocol buffersJoey Hess2017-04-27
| | | | | | | | | | | | | | | | | | | | | | | | This way it's not tied to details of the haskell binary library, and implementations in other languages should be fairly simple to do. The haskell protobuf library was used because it does not need extra tooling or build steps. So I didn't write a .proto file, but one could fairly easily be written by following ProtocolBuffers.hs and translating it. ProtocolBuffers.hs is *extremely* repetative and tedious code. Surely there must be a way to not need to write all of that? Oh well, I wrote it.. Sizes of serialized messages: ">>> debug-me session started": 121 sending a single key press: 169 This seems equally as efficient as the binary serialization was; that was 165 bytes before elapsedTime was added. This commit was sponsored by Ethan Aubin.
* rename LogMessage to AnyMessageJoey Hess2017-04-27
| | | | Not related to the Log anymore.
* fix connection closingJoey Hess2017-04-24
| | | | Now when the user quits, the developer also exits.
* switch to TMChans so they can be closed when a connection is DoneJoey Hess2017-04-24
|
* better workaround for https://github.com/jaspervdj/websockets/issues/142Joey Hess2017-04-24
|
* 30 second ping threadJoey Hess2017-04-24
|
* also enable compression in serverJoey Hess2017-04-24
|
* websockets-0.11.0.0 including enabling compressionJoey Hess2017-04-24
| | | | | Does not currently work, see https://github.com/jaspervdj/websockets/issues/140
* add framing protocol for websocketsJoey Hess2017-04-22
|
* clean up connection closingJoey Hess2017-04-22
| | | | | | For some reason, runClient throws ConnectionClosed on apparently clean shutdown. This happens even though clientApp uses sendClose, and the server receives it and shuts down entirely cleanly.
* use UUID to generate a unique SessionIDJoey Hess2017-04-21
|
* working toward getting developer mode connection to server workingJoey Hess2017-04-21
|
* client now fully workingJoey Hess2017-04-21
|
* initial http serverJoey Hess2017-04-21
Incomplete, but the client is able to connect and send messages which get logged. Split up debug-me.hs into Role/* Switched from cereal to binary, since websockets operate on lazy ByteStrings, and using cereal would involve a copy on every receive. This commit was sponsored by Boyd Stephen Smith Jr. on Patreon.