Commit graph

118 commits

Author SHA1 Message Date
Gered 472a551606 remove hardcoded browserchannel protocol version number 2016-05-13 14:01:15 -04:00
Gered 5056d14d3a add trace log output to clj-browserchannel 2016-05-13 12:39:13 -04:00
Gered 63a74707fa another test, and some more helper functions 2016-05-12 17:19:51 -04:00
Gered b0463fbbd7 add more backchannel tests. add various test helper functions 2016-05-12 16:44:40 -04:00
Gered ae6fa268cc simplify 2016-05-12 16:43:38 -04:00
Gered 3f81f59a2a enforce valid session requirement for all backchannel requests
not checking for this results in a NPE anyway, definitely better to
return a nicer error result
2016-05-12 14:52:07 -04:00
Gered 4554adcecd start adding bind channel unit tests 2016-05-12 13:43:40 -04:00
Gered 1b3a0e99bc ensure initial session timeout can actually timeout on new session
the way this was being triggered would cause the session timeout to
be triggered at the proper timeout interval, but due to the call
to refresh-session-timeout not being done via the session agent and
the use of send-off, the session timeout handler would not have any
way to actually remove the session from the global sessions atom

in practice this would only actually be a problem if clients were
creating a session and then never performing a GET request to create
a backchannel
2016-05-12 13:08:50 -04:00
Gered e597737204 output a little warning to indicate why this test delays 2016-05-12 12:26:50 -04:00
Gered 7e2d87731c rename some test stuff 2016-05-12 12:17:19 -04:00
Gered 605d6c5d51 add mock http request unit tests for the test channel 2016-05-12 12:14:54 -04:00
Gered 89ad55b9c8 minor cleanups 2016-05-11 15:45:58 -04:00
Gered 548ff7825d add some initial session tests 2016-05-11 15:36:29 -04:00
Gered 3bdf0868cf renaming some arguments for clarity 2016-05-11 13:45:25 -04:00
Gered 8aa0368494 add some more arraybuffer unit tests 2016-05-11 12:06:51 -04:00
Gered 19cfc50762 begin adding some unit tests 2016-05-11 10:58:52 -04:00
Gered d4c5784b4a switch to cheshire for json encoding
cheshire is significantly faster then data.json. i'm assuming the only
reason data.json was being used was due to the age of this project
2016-05-11 09:27:22 -04:00
Gered 37db9ce909 add response-timeout option to immutant adapter (same as jetty adapter) 2016-05-09 20:06:12 -04:00
Gered 579945fbda update jetty adapter to just use the jetty instance pulled in by ring
this also happens to be jetty 9, which is good as 7 and 8 are EOL
2016-05-09 19:09:07 -04:00
Gered 73bd151893 add logback.xml config to stop jetty from spamming log output 2016-05-09 18:01:38 -04:00
Gered 4fbf7b7c7d some more doc comments and minor formatting 2016-05-09 17:49:42 -04:00
Gered 333e4873d5 adding doc comments and changing some internal use functions to private 2016-05-09 16:29:24 -04:00
Gered 1eda612d0c don't trigger on-sent event if the delivered array is empty 2016-05-09 13:22:35 -04:00
Gered 36665bc123 fix decode-queued-map 2016-05-09 13:19:53 -04:00
Gered 6916f3efb2 send-map shouldn't really be returning the actual session agent 2016-05-09 13:17:13 -04:00
Gered 6674d171c3 update client & server send fn's to allow sending even non-map data
i personally think this was an important change as the default encoding
of maps to be sent as json is somewhat lossy (keywords converted to
strings, would never be able to get this 100% perfect using json alone
without a more complex encoding solution). encoding to edn is the
perfect solution to this.

since browserchannel pretty much requires the final sent data to be
json encoded, we just serialize the clojure data being sent to an
edn string within a root json object.

this does ultimately mean we have to do a little bit of pre-parsing
of sent and received maps to encode/decode properly and make it
completely transparent to application code, but i think it's an
acceptable tradeoff.
2016-05-09 12:45:17 -04:00
Gered b86d048e64 fix get-status (apparently didn't test it well enough) 2016-05-08 22:41:25 -04:00
Gered 9cc8bf5234 formatting 2016-05-08 20:30:25 -04:00
Gered d0cd1d0bca doc-comments 2016-05-08 20:28:47 -04:00
Gered 3aed2c3b1b mark a bunch of internal functions/defs as private where appropriate
the real purpose of doing this is of course to make it more obvious
to anyone reading this code what is the actual intended public API
and what isn't
2016-05-08 19:30:36 -04:00
Gered 9d314c4d88 super nitpicky code formatting
i apologize to anyone looking at this commit and wondering why i would
do this, but all these little "off" formatting things have been bugging
me all day while looking at this code. i simply had to do something.
2016-05-08 19:20:28 -04:00
Gered 4e63631854 update disconnection reason strings to be a bit more descriptive 2016-05-08 19:03:31 -04:00
Gered 337b1faf27 update chat-demo 2016-05-08 19:01:24 -04:00
Gered 49409cac62 add server-side helper functions 2016-05-08 19:01:08 -04:00
Gered 0fb68755fe rename 2016-05-08 19:00:45 -04:00
Gered da2b5d94b2 update how browserchannel server-side application event handling works
up until now, a single event handler "on-session" could be provided to
wrap-browserchannel which would be invoked each time a new client
session was created. it was then the application's responsibility to
register listeners for close/receive events inside this on-session event
handler.

this was kind of clunky honestly. basically every application would want
to use all of these events, so why not reduce the boilerplate needed?

this change makes it so a map of event handlers (:on-open, :on-close and
:on-receive) can be passed under wrap-browserchannel's options map (in
the key :events). this makes it simpler for an application to set up
browserchannel event handlers, and it works in basically the exact same
way as the clientside event handler registration works right now
2016-05-08 18:44:54 -04:00
Gered ecb66421b0 rename clj-browserchannel-server as it now also includes cljs stuff 2016-05-08 18:00:42 -04:00
Gered a58f6934c7 update chat-demo to use an anti-forgery token to demo how to set it up 2016-05-08 17:59:31 -04:00
Gered c18f295018 simplify stuff a bit 2016-05-08 15:51:51 -04:00
Gered a4b2e14897 add clojurescript client-side browserchannel api 2016-05-08 14:34:22 -04:00
Gered 161e7c3999 remove unneeded requires 2016-05-08 12:42:41 -04:00
Gered 7ada1c27c7 make immutant a provided dependency for the async adapter library 2016-05-08 12:05:28 -04:00
Gered b61be5ae21 some namespace renaming to keep things consistent (nitpicky...) 2016-05-08 11:56:33 -04:00
Gered 613c75953b update some project names and links to refer to this forked repo
project name updates are most important as i'll be deploying to clojars
and don't want any conflicts with the existing project
2016-05-07 17:24:35 -04:00
Gered 8e503e44e1 add immutant adapter project README.md 2016-05-07 17:12:08 -04:00
Gered 3a196a3ff2 add extra example code to show how to enable debug logging client-side 2016-05-07 17:10:08 -04:00
Gered 72c886e772 add immutant adapter support to the chat-demo 2016-05-07 16:58:36 -04:00
Gered 1ade049b2b add clj-browserchannel-immutant-adapter 2016-05-07 16:52:22 -04:00
Gered 02b2f551e1 forgot to bump up dependency version 2016-05-07 16:45:06 -04:00
Gered 722776ed2e bump versions 2016-05-07 16:39:54 -04:00