Yep, I was running into the two problems you pointed out:  First, I needed 
to use a relative URL in make-channel-socket! and that necessitated 
delivering my HTML through http-kit rather than the shortcut of reading it 
from the file system using file://...  Once I did that, an assertion nicely 
documented the use of chsk-send! (thanks for that!).  One small thing that 
tripped me up: It seems the event id must be a namespaced keyword.  I 
haven't thoroughly rtfm yet so if that's doc'd, bad on me.  

Thanks for the pointers!

On Sunday, March 2, 2014 11:27:23 AM UTC-8, Peter Taoussanis wrote:
>
> Hi Mark,
>
> I'm trying to learn Sente using the LightTable browser connected repl.  
>>
>
> Ahh, nice. Haven't tried LightTable yet myself, but I'd think it should 
> work okay.
>
>  
>
>> From the JS console, I see repeated, failed attempts to connect the 
>> server.
>>
>
> The URL is what's tripping you up here. Is there a reason you specifically 
> want to provide an absolute URL? At the moment `make-channel-socket!` just 
> takes a path (like "/chsk"). The host and port, etc. will all be determined 
> for you automatically. "/chsk" is a reasonable choice btw - it's not 
> user-facing so doesn't need to be particularly meaningful to anyone but you.
>
> Taking a very quick look at the source for the CLJS make-channel-socket!, 
>> it seems that it tries to resolve the url using the CLJS chsk-url function 
>> which, in turn, uses encore/get-window-location.
>>
>
> That's correct. It just grabs the host and protocol of whatever page is 
> serving the JavaScript. HTTPS protocols will be converted to WSS, 
> everything else goes to WS. You should be fine there, I'd think.
>
> > (put! ch-chsk "From client!")
>
> Note that you'll never be putting to the `ch-chsk` yourself, it's for 
> receiving only. To send events you'll use the `chsk-send!` fn (the API is 
> described at https://github.com/ptaoussanis/sente#now-what).
>
> I also updated the repo a couple days ago to include a working example 
> project that you could pull into LightTable to hack on. Otherwise feel free 
> to open a GitHub issue if you have any other questions - am happy to help.
>
> Cheers :-)
>
> - Peter
>  

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to