Thanks all, and yes, I guess the question is more general then sente. Next up, any ideas how to get apache 2.2 on debian to proxy web sockets without recompiling apache ;).
> On 28 May 2015, at 08:20, Eduard Bondarenko <[email protected]> wrote: > > I use chsk-url-fn to connect to different domain like this: > > ;; create the Sente web socket connection stuff when we are loaded: > (let [{:keys [chsk ch-recv send-fn state]} > (sente/make-channel-socket! > "/ws" ; Note the same path as before > {:type :auto ; e/o #{:auto :ajax > ; :ws} > :chsk-url-fn (fn [path window-location websocket?] > (case (:hostname window-location) > "localhost" "ws://localhost:8080/ws" > "ws://<ip>:8080/ws")) > })] > (def chsk chsk) > (def ch-chsk ch-recv) ; ChannelSocket's receive channel > (def chsk-send! send-fn) ; ChannelSocket's send API fn > (def chsk-state state) ; Watchable, read-only atom > ) > > > On Thu, May 28, 2015 at 9:55 AM, Daniel Compton > <[email protected] <mailto:[email protected]>> > wrote: > Hi Colin > > Take a look at https://github.com/ptaoussanis/sente/issues/50 > <https://github.com/ptaoussanis/sente/issues/50>, particularly the last few > messages. It describes how to set the connection URL. > > Though it sounds like your issue is more about determining the context root > of a cljs app, not specifically about Sente? > > On Thu, 28 May 2015 at 4:33 pm Keith Irwin <[email protected] > <mailto:[email protected]>> wrote: > If your client is served from the backend (instead of a separate web-server > or proxy), could you examine the path of the script itself and parse for the > first part as context? > > Something like: > > (def context > (or (-> (.. js/document -location -pathname) (s/split #"/") second) > "")) > > Given “/context/main.js” you’d get “context”. Maybe a conditional to check if > the context is the name of the script itself (main.js). > > Would that work in your case? > >> On May 27, 2015, at 8:01 PM, Colin Yates <[email protected] >> <mailto:[email protected]>> wrote: >> >> I am using the excellent sente which needs to know what the URL for the >> server side end point is. Most examples simply define "/chsk" but this >> doesn't work if there is a context root. >> >> For example, if my web app's index root is "/abc" then I need to specify >> "/abc/chsk" in the clojurescript. >> >> Are there any neat tricks for determining the context root in the >> clojurescript environment (I guess not) or any way to parameterise my >> clojurescript outside of lein? >> >> Thanks! >> >> -- >> Note that posts from new members are moderated - please be patient with your >> first post. >> --- >> You received this message because you are subscribed to the Google Groups >> "ClojureScript" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to [email protected] >> <mailto:[email protected]>. >> To post to this group, send email to [email protected] >> <mailto:[email protected]>. >> Visit this group at http://groups.google.com/group/clojurescript >> <http://groups.google.com/group/clojurescript>. > > > -- > Note that posts from new members are moderated - please be patient with your > first post. > --- > You received this message because you are subscribed to the Google Groups > "ClojureScript" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected] > <mailto:[email protected]>. > To post to this group, send email to [email protected] > <mailto:[email protected]>. > Visit this group at http://groups.google.com/group/clojurescript > <http://groups.google.com/group/clojurescript>. > > -- > Note that posts from new members are moderated - please be patient with your > first post. > --- > You received this message because you are subscribed to the Google Groups > "ClojureScript" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected] > <mailto:[email protected]>. > To post to this group, send email to [email protected] > <mailto:[email protected]>. > Visit this group at http://groups.google.com/group/clojurescript > <http://groups.google.com/group/clojurescript>. > > > -- > Note that posts from new members are moderated - please be patient with your > first post. > --- > You received this message because you are subscribed to the Google Groups > "ClojureScript" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected] > <mailto:[email protected]>. > To post to this group, send email to [email protected] > <mailto:[email protected]>. > Visit this group at http://groups.google.com/group/clojurescript > <http://groups.google.com/group/clojurescript>. -- Note that posts from new members are moderated - please be patient with your first post. --- You received this message because you are subscribed to the Google Groups "ClojureScript" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/clojurescript.
