1. It's possible by setting WebSharper.Remoting.EndPoint <- "http://yoururl.com". Then you can call RPC function as usual and they will send the query to the set location.
  2. I don't think it's currently supported to plug your own serialization and that would be quite some work. The JavaScript representation is given and the serializer works with that, so to roll your own you'd need to convert between how WS represents types in JS inetrnally and your own representation to use for serialization.

You can reuse WebSharper.Core.Json for serialization though. This module is not documented AFAIK but quite simple to use:

1
2
3
4
5
6
7
8
9
10
11
12
13
module J = WebSharper.Core.Json

let private jP = J.Provider.Create()
let ToJString (msg: 'T) =
    let enc = jP.GetEncoder<'T>()
    enc.Encode msg
    |> jP.Pack
    |> J.Stringify

let FromJString str : 'T =
    let dec = jP.GetDecoder<'T>()
    J.Parse str
    |> dec.Decode

Do note that WebSharper needs to know the concrete types at compilation type.

Edit: I might have misunderstood the first question. I think RPC calls will always send the query to http://yoururl.com/?, so that probably cannot be changed. RPC calls are integrated into the system and thus not very customizable. You might be better off writing your own AJAX calls if you need functionality like this.

By on 3/27/2015 2:27 AM ()
IntelliFactory Offices Copyright (c) 2011-2012 IntelliFactory. All rights reserved.
Home | Products | Consulting | Trainings | Blogs | Jobs | Contact Us | Terms of Use | Privacy Policy | Cookie Policy
Built with WebSharper