single-page-applicationrpcwebsharper

websharper access to rpc from another site (SPA)


I've got a client-server (with transpiled js and rpc calls to server) application with websharper, and it runs perfectly fine.

Now I need a single javascript file for another site (a WordPress app) and from this script, I'd like to access to everything public (non protected rpc) I made in my former client-server application.

The ideal would be to be able to use the websharper SPA template and "link" to the client-server project.

I've got two problems: - First, rpc signature are encoded with a hash which seems to be local to the app (no simple way to reproduct this hash outside it) - Second, apparently there is no way to actually link the generated dll from the client-server app into the new SPA template and use the exported rpc method signatures for the SPA.

Am I missing something, how to make this work ?

Regards,


Solution

  • Referencing your client-server application from your SPA should work just fine; you just need to make sure that it points to the right URL by calling the following somewhere in your SPA:

    WebSharper.Remoting.EndPoint <- "http://your-client-server-application's-url"