├── .gitattributes
├── .gitignore
├── .nuget
├── NuGet.Config
├── NuGet.exe
└── NuGet.targets
├── README.markdown
├── SignalRExample.sln
├── SignalRServer
├── App.config
├── Dynamic.fs
├── Interactive.fsx
├── Program.fs
├── SignalRServer.fsproj
├── TaskHelper.fs
└── packages.config
├── SignalRSilverlightClient
├── Interactive.fsx
├── SignalRSilverlightClient.fs
├── SignalRSilverlightClient.fsproj
└── packages.config
├── SilverlightTestUI
├── App.xaml
├── App.xaml.cs
├── MainPage.xaml
├── MainPage.xaml.cs
├── Properties
│ ├── AppManifest.xml
│ └── AssemblyInfo.cs
├── SilverlightTestUI.csproj
└── packages.config
└── WebApp
├── Global.asax
├── Global.asax.cs
├── JavaScriptTestUITestPage.html
├── Properties
└── AssemblyInfo.cs
├── Silverlight.js
├── SilverlightTestUITestPage.html
├── Web.Debug.config
├── Web.Release.config
├── Web.config
├── WebApp.csproj
├── clientaccesspolicy.xml
├── crossdomain.xml
└── packages.config
/.gitattributes:
--------------------------------------------------------------------------------
1 | # Auto detect text files and perform LF normalization
2 | * text=auto
3 |
4 | # Custom for Visual Studio
5 | *.cs diff=csharp
6 | *.sln merge=union
7 | *.csproj merge=union
8 | *.vbproj merge=union
9 | *.fsproj merge=union
10 | *.dbproj merge=union
11 |
12 | # Standard to msysgit
13 | *.doc diff=astextplain
14 | *.DOC diff=astextplain
15 | *.docx diff=astextplain
16 | *.DOCX diff=astextplain
17 | *.dot diff=astextplain
18 | *.DOT diff=astextplain
19 | *.pdf diff=astextplain
20 | *.PDF diff=astextplain
21 | *.rtf diff=astextplain
22 | *.RTF diff=astextplain
23 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 |
2 | #ignore thumbnails created by windows
3 |
4 | [Tt]humbs.db
5 |
6 | #Ignore files build by Visual Studio
7 |
8 | *.obj
9 |
10 | *.exe
11 |
12 | *.pdb
13 | *.xap
14 | *.user
15 |
16 | *.aps
17 |
18 | *.pch
19 |
20 | *.vspscc
21 |
22 | *_i.c
23 |
24 | *_p.c
25 |
26 | *.ncb
27 |
28 | *.suo
29 |
30 | *.tlb
31 |
32 | *.tlh
33 |
34 | *.bak
35 |
36 | *.cache
37 |
38 | *.ilk
39 |
40 | *.log
41 |
42 | [Bb]in
43 |
44 | [Dd]ebug*/
45 |
46 | *.lib
47 |
48 | *.sbr
49 |
50 | obj/
51 |
52 | [Rr]elease*/
53 |
54 | _ReSharper*/
55 |
56 | [Tt]est[Rr]esult*/
57 | [Pp]ackages/
58 | AutoTest.Net*/
--------------------------------------------------------------------------------
/.nuget/NuGet.Config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/.nuget/NuGet.exe:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Thorium/SignalR-FSharp-Example/d8a5ee546a648e95efe6606ece5fa38dfb01cc9c/.nuget/NuGet.exe
--------------------------------------------------------------------------------
/.nuget/NuGet.targets:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | $(MSBuildProjectDirectory)\..\
5 |
6 |
7 | false
8 |
9 |
10 | false
11 |
12 |
13 | true
14 |
15 |
16 | false
17 |
18 |
19 |
20 |
21 |
22 |
26 |
27 |
28 |
29 |
30 | $([System.IO.Path]::Combine($(SolutionDir), ".nuget"))
31 | $([System.IO.Path]::Combine($(ProjectDir), "packages.config"))
32 |
33 |
34 |
35 |
36 | $(SolutionDir).nuget
37 | packages.config
38 |
39 |
40 |
41 |
42 | $(NuGetToolsPath)\NuGet.exe
43 | @(PackageSource)
44 |
45 | "$(NuGetExePath)"
46 | mono --runtime=v4.0.30319 $(NuGetExePath)
47 |
48 | $(TargetDir.Trim('\\'))
49 |
50 | -RequireConsent
51 | -NonInteractive
52 |
53 |
54 | $(NuGetCommand) install "$(PackagesConfig)" -source "$(PackageSources)" $(NonInteractiveSwitch) $(RequireConsentSwitch) -solutionDir "$(SolutionDir) "
55 | $(NuGetCommand) pack "$(ProjectPath)" -Properties Configuration=$(Configuration) $(NonInteractiveSwitch) -OutputDirectory "$(PackageOutputDir)" -symbols
56 |
57 |
58 |
59 | RestorePackages;
60 | $(BuildDependsOn);
61 |
62 |
63 |
64 |
65 | $(BuildDependsOn);
66 | BuildPackage;
67 |
68 |
69 |
70 |
71 |
72 |
73 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
88 |
89 |
92 |
93 |
94 |
95 |
97 |
98 |
101 |
102 |
103 |
104 |
105 |
106 |
107 |
108 |
109 |
110 |
111 |
112 |
113 |
114 |
115 |
130 |
131 |
132 |
133 |
--------------------------------------------------------------------------------
/README.markdown:
--------------------------------------------------------------------------------
1 | **Example of SignalR with F-Sharp (and Silverlight 5 or Javascript):**
2 |
3 | - SignalR is a library (for web-based Publish/Subscribe -pattern) on top
4 | of WebSockets, which is HTML5 API that enables bi-directional communication
5 | between the browser and server. SignalR will fallback to other techniques and
6 | technologies when WebSockets are not available.
7 | [http://signalr.net/][1]
8 |
9 | - F-Sharp (F#) is multiparadigm (functional-first) programming language
10 | mainly for .NET environment.
11 | [http://fsharp.org/][2]
12 |
13 | - This sample uses Reactive Extensions 2.1 to communicate with SignalR,
14 | on both client and server side. Reactive Extensions is a library to
15 | compose asynchronous and event-based programs using observable
16 | collections and LINQ-style query operators.
17 | [http://msdn.microsoft.com/en-us/data/gg577609.aspx][3]
18 |
19 | - For server side:
20 | This could work purely from F# as Owin ([http://owin.org/][4]) console application
21 | but now F#-server-side is called from an empty ASP.NET C# Web Application.
22 | (You can start OWin from F# Interactive...)
23 |
24 | - For client side:
25 | Silverlight 5.0 application using F#-library
26 | and Silverlight 5.0 XAML/C# application to show the user interface.
27 | [http://www.silverlight.net][5]
28 | There is also jQuery/JavaScript test page, if you don't want to use Silverlight.
29 |
30 | - This proof of concept/sample/tutorial/demo is developed with
31 | Visual Studio 2012. References are resolved via NuGet.
32 | F# compiler won't auto-restore packages on compile.
33 | **So go first to Tools -> Library Package Manager -> NuGet
34 | and press "Restore" to restore all the references, and then rebuild.**
35 |
36 | - SignalR supports two kinds of connections: Hub and PersistentConnection
37 | Both are working with Silverlight and JavaScript.
38 |
39 |
40 |
41 | [1]: http://signalr.net/
42 | [2]: http://fsharp.org/
43 | [3]: http://msdn.microsoft.com/en-us/data/gg577609.aspx
44 | [4]: http://owin.org/
45 | [5]: http://www.silverlight.net
46 |
--------------------------------------------------------------------------------
/SignalRExample.sln:
--------------------------------------------------------------------------------
1 |
2 | Microsoft Visual Studio Solution File, Format Version 12.00
3 | # Visual Studio 2013
4 | VisualStudioVersion = 12.0.21005.1
5 | MinimumVisualStudioVersion = 10.0.40219.1
6 | Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = ".nuget", ".nuget", "{0C38153F-BADE-4DBB-8337-E2A414D0599A}"
7 | ProjectSection(SolutionItems) = preProject
8 | .nuget\NuGet.Config = .nuget\NuGet.Config
9 | .nuget\NuGet.exe = .nuget\NuGet.exe
10 | .nuget\NuGet.targets = .nuget\NuGet.targets
11 | EndProjectSection
12 | EndProject
13 | Project("{F2A71F9B-5D33-465A-A702-920D77279786}") = "SignalRServer", "SignalRServer\SignalRServer.fsproj", "{B79D6D3C-23FA-4D27-AEAD-DC2391000220}"
14 | EndProject
15 | Project("{F2A71F9B-5D33-465A-A702-920D77279786}") = "SignalRSilverlightClient", "SignalRSilverlightClient\SignalRSilverlightClient.fsproj", "{3BE39CBE-6F97-4D0F-B559-BB065562BEF6}"
16 | EndProject
17 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SilverlightTestUI", "SilverlightTestUI\SilverlightTestUI.csproj", "{25E1347B-C896-4440-8C57-3557535DF4CA}"
18 | EndProject
19 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WebApp", "WebApp\WebApp.csproj", "{0CEF79E9-0A53-40A5-829B-B9EA7EBFAE54}"
20 | EndProject
21 | Global
22 | GlobalSection(SolutionConfigurationPlatforms) = preSolution
23 | Debug|Any CPU = Debug|Any CPU
24 | Release|Any CPU = Release|Any CPU
25 | EndGlobalSection
26 | GlobalSection(ProjectConfigurationPlatforms) = postSolution
27 | {B79D6D3C-23FA-4D27-AEAD-DC2391000220}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
28 | {B79D6D3C-23FA-4D27-AEAD-DC2391000220}.Debug|Any CPU.Build.0 = Debug|Any CPU
29 | {B79D6D3C-23FA-4D27-AEAD-DC2391000220}.Release|Any CPU.ActiveCfg = Release|Any CPU
30 | {B79D6D3C-23FA-4D27-AEAD-DC2391000220}.Release|Any CPU.Build.0 = Release|Any CPU
31 | {3BE39CBE-6F97-4D0F-B559-BB065562BEF6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
32 | {3BE39CBE-6F97-4D0F-B559-BB065562BEF6}.Debug|Any CPU.Build.0 = Debug|Any CPU
33 | {3BE39CBE-6F97-4D0F-B559-BB065562BEF6}.Release|Any CPU.ActiveCfg = Release|Any CPU
34 | {3BE39CBE-6F97-4D0F-B559-BB065562BEF6}.Release|Any CPU.Build.0 = Release|Any CPU
35 | {25E1347B-C896-4440-8C57-3557535DF4CA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
36 | {25E1347B-C896-4440-8C57-3557535DF4CA}.Debug|Any CPU.Build.0 = Debug|Any CPU
37 | {25E1347B-C896-4440-8C57-3557535DF4CA}.Release|Any CPU.ActiveCfg = Release|Any CPU
38 | {25E1347B-C896-4440-8C57-3557535DF4CA}.Release|Any CPU.Build.0 = Release|Any CPU
39 | {0CEF79E9-0A53-40A5-829B-B9EA7EBFAE54}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
40 | {0CEF79E9-0A53-40A5-829B-B9EA7EBFAE54}.Debug|Any CPU.Build.0 = Debug|Any CPU
41 | {0CEF79E9-0A53-40A5-829B-B9EA7EBFAE54}.Release|Any CPU.ActiveCfg = Release|Any CPU
42 | {0CEF79E9-0A53-40A5-829B-B9EA7EBFAE54}.Release|Any CPU.Build.0 = Release|Any CPU
43 | EndGlobalSection
44 | GlobalSection(SolutionProperties) = preSolution
45 | HideSolutionNode = FALSE
46 | EndGlobalSection
47 | EndGlobal
48 |
--------------------------------------------------------------------------------
/SignalRServer/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
--------------------------------------------------------------------------------
/SignalRServer/Dynamic.fs:
--------------------------------------------------------------------------------
1 | module Dynamic
2 |
3 | // Source code from: http://www.fssnip.net/2U
4 |
5 | open System
6 | open System.Runtime.CompilerServices
7 | open Microsoft.CSharp.RuntimeBinder
8 |
9 | // Simple implementation of ? operator that works for instance
10 | // method calls that take a single argument and return some result
11 | let (?) (inst:obj) name (arg:'T) : 'R =
12 | // TODO: For efficient implementation, consider caching of call sites
13 | // Create dynamic call site for converting result to type 'R
14 | let convertSite =
15 | CallSite>.Create
16 | (Binder.Convert(CSharpBinderFlags.None, typeof<'R>, null))
17 |
18 | // Create call site for performing call to method with the given
19 | // name and a single parameter of type 'T
20 | let callSite =
21 | CallSite>.Create
22 | (Binder.InvokeMember
23 | ( CSharpBinderFlags.None, name, null, null,
24 | [| CSharpArgumentInfo.Create(CSharpArgumentInfoFlags.None, null);
25 | CSharpArgumentInfo.Create(CSharpArgumentInfoFlags.None, null) |]))
26 |
27 | // Run the method call using second call site and then
28 | // convert the result to the specified type using first call site
29 | convertSite.Target.Invoke
30 | (convertSite, callSite.Target.Invoke(callSite, inst, arg))
31 |
--------------------------------------------------------------------------------
/SignalRServer/Interactive.fsx:
--------------------------------------------------------------------------------
1 | //SignalR:
2 | #r "../packages/Newtonsoft.Json.5.0.8/lib/net45/Newtonsoft.Json.dll"
3 | #r "../packages/Microsoft.AspNet.SignalR.Core.2.0.0/lib/net45/Microsoft.AspNet.SignalR.Core.dll"
4 |
5 | //Reactive Extensions:
6 | #r "System.ComponentModel.Composition.dll"
7 | #r "../packages/Rx-Interfaces.2.1.30214.0/lib/Net45/System.Reactive.Interfaces.dll"
8 | #r "../packages/Rx-Core.2.1.30214.0/lib/Net45/System.Reactive.Core.dll"
9 | #r "../packages/Rx-Linq.2.1.30214.0/lib/Net45/System.Reactive.Linq.dll"
10 |
11 | //Dynamic:
12 | #r "Microsoft.CSharp.dll"
13 | #load "Dynamic.fs"
14 |
15 | //ASP.NET Web Application routing (method SetupRouting):
16 | #r "System.Web"
17 | #r "../packages/Microsoft.AspNet.SignalR.SystemWeb.2.0.0/lib/net45/Microsoft.AspNet.SignalR.SystemWeb.dll"
18 |
19 | //OWIN host:
20 | #r "../packages/Owin.1.0/lib/net40/Owin.dll"
21 | #r "../packages/Microsoft.Owin.Hosting.2.0.1/lib/net45/Microsoft.Owin.Hosting.dll"
22 | //#r "../packages/Microsoft.Owin.Host.SystemWeb.2.0.1/lib/net45/Microsoft.Owin.Host.SystemWeb.dll"
23 | //#r "../packages/Microsoft.AspNet.SignalR.Owin.1.1.1/lib/net45/Microsoft.AspNet.SignalR.Owin.dll"
24 | #r "../packages/Microsoft.Owin.Host.HttpListener.2.0.1/lib/net45/Microsoft.Owin.Host.HttpListener.dll"
25 | #r "../packages/Microsoft.Owin.Security.2.0.1/lib/net45/Microsoft.Owin.Security.dll"
26 | #r "../packages/Microsoft.Owin.2.0.1/lib/net45/Microsoft.Owin.dll"
27 |
28 |
29 | #load "TaskHelper.fs"
30 |
31 |
32 | #load "Program.fs"
33 | open SignalRServer.MyServer
34 |
35 | //Let's start Owin-server on F#-interactive!
36 | main ()
37 |
38 | //----------------------------------------------------------------------------------------------------------------------
39 | //This sends a message to all clients
40 | sendAll "hello"
41 |
42 | //This would send "ping!" to all clients every 5 seconds
43 | SignalRCommunication()
44 |
--------------------------------------------------------------------------------
/SignalRServer/Program.fs:
--------------------------------------------------------------------------------
1 | namespace SignalRServer
2 |
3 | open Microsoft.AspNet.SignalR
4 | open Microsoft.AspNet.SignalR.Hubs
5 |
6 | open System
7 | open System.Runtime
8 | open System.Reactive.Concurrency
9 | open System.Reactive.Linq
10 | open System.Web
11 | open System.Web.Routing
12 |
13 | open Dynamic
14 | open TaskHelper
15 | open System.Threading.Tasks
16 |
17 | module MyServer =
18 |
19 | //SignalR supports two kinds of connections: Hub and PersistentConnection
20 |
21 | type MyConnection() as this =
22 | inherit PersistentConnection()
23 | override x.OnConnected(req,id) =
24 | this.Connection.Send(id, "Welcome!") |> ignore
25 | base.OnConnected(req,id)
26 | override x.OnReceived(req,id,data) =
27 | this.Connection.Send(id, "Thanks for " + data) |> ignore
28 | base.OnReceived(req,id,data)
29 |
30 | []
31 | type MyHub() as this =
32 | inherit Hub()
33 | override x.OnConnected() =
34 | base.OnConnected()
35 | // Define the MyCustomServerFunction on the server.
36 | member x.MyCustomServerFunction(fromClient : string) : unit =
37 | let (t:Task) = this.Clients.Caller?myCustomClientFunction("Thanks for " + fromClient)
38 | t.Wait()
39 |
40 | let sendAll msg =
41 | GlobalHost.ConnectionManager.GetConnectionContext().Connection.Broadcast(msg)
42 | |> Async.awaitPlainTask |> ignore
43 | GlobalHost.ConnectionManager.GetHubContext().Clients.All?myCustomClientFunction(msg)
44 | |> Async.awaitPlainTask |> ignore
45 |
46 |
47 | //Send some responses from server to client...
48 | let SignalRCommunicationSendPings() =
49 |
50 | //Send first message
51 | sendAll("Hello world!")
52 |
53 | //Send ping on every 5 seconds
54 | let pings = Observable.Interval(TimeSpan.FromSeconds(5.0), Scheduler.Default)
55 | pings.Subscribe(fun s -> sendAll("ping!")) |> ignore
56 |
57 | //------------------------------------------------------------------------------------------------------------
58 | // Options of hosting:
59 | // A) ASP.NET Web Application
60 | // B) OWIN server: Command-line application
61 |
62 | // Signal-R 1.1.3: ASP.NET Web Application. Setup routing here, this is called from Global.asax.cs
63 | // let SetupRouting() =
64 | // RouteTable.Routes.MapConnection("signalrConn", "signalrConn") |> ignore
65 | //
66 | // let hubc = new HubConfiguration(EnableDetailedErrors = true, EnableCrossDomain = true)
67 | // RouteTable.Routes.MapHubs("/signalrHub", hubc) |> ignore
68 | // SignalRCommunicationSendPings()
69 |
70 | // Signal-R 2.0: Use OWIN:
71 | // (If you use Silverlight client, then you would need to supply clientaccesspolicy.xml and crossdomain.xml)
72 | open Microsoft.Owin.Hosting
73 | let config = new HubConfiguration(EnableDetailedErrors = true)
74 |
75 | type MyWebStartup() =
76 | member x.Configuration(app:Owin.IAppBuilder) =
77 | Owin.OwinExtensions.MapSignalR(app, "/signalrConn") |> ignore
78 |
79 | Owin.OwinExtensions.MapSignalR(app, "/signalrHub", config) |> ignore
80 | //SignalRCommunicationSendPings()
81 | ()
82 |
83 | ////Cross-Origin Resource Sharing (Cors) support:
84 | // member x.Configuration(app:Owin.IAppBuilder) =
85 | // Owin.MapExtensions.Map(app, "/signalrHub",
86 | // fun map ->
87 | // do Owin.CorsExtensions.UseCors(map, Microsoft.Owin.Cors.CorsOptions.AllowAll) |> ignore
88 | // Owin.OwinExtensions.RunSignalR(map, config);
89 | // ) |> ignore
90 | // //SignalRCommunicationSendPings()
91 | // ()
92 |
93 |
94 | [)>]
95 | do()
96 |
97 | // If you want to run this as console application, then uncomment EntryPoint-attribute and
98 | // from SignalRServer project properties change this application "Output Type" to: Console Application
99 | // (But then this will be .exe-file instead of dll-file and you can't reference it from
100 | // the current ASP.NET Web Application, project WebApp.)
101 | //[]
102 | let main argv =
103 | //Note that server and client has to use the same port
104 | let url = "http://localhost:8080"
105 | // Here you would need new empty C#-class just for configuration: ServerStartup.MyWebStartup:
106 | use app = WebApp.Start(url)
107 | Console.WriteLine "Server running..."
108 | Console.ReadLine() |> ignore
109 | app.Dispose()
110 | Console.WriteLine "Server closed."
111 | 0
112 |
--------------------------------------------------------------------------------
/SignalRServer/SignalRServer.fsproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Debug
6 | AnyCPU
7 | 2.0
8 | b79d6d3c-23fa-4d27-aead-dc2391000220
9 | Library
10 | SignalRServer
11 | SignalRServer
12 | v4.5
13 | SignalRServer
14 | ..\
15 | true
16 | 4.3.0.0
17 |
18 |
19 | true
20 | full
21 | false
22 | false
23 | bin\Debug\
24 | DEBUG;TRACE
25 | 3
26 | AnyCPU
27 | bin\Debug\SignalRServer.XML
28 | true
29 |
30 |
31 | pdbonly
32 | true
33 | true
34 | bin\Release\
35 | TRACE
36 | 3
37 | AnyCPU
38 | bin\Release\SignalRServer.XML
39 | true
40 |
41 |
42 | 11
43 |
44 |
45 |
46 |
47 | $(MSBuildExtensionsPath32)\..\Microsoft SDKs\F#\3.0\Framework\v4.0\Microsoft.FSharp.Targets
48 |
49 |
50 |
51 |
52 | $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)\FSharp\Microsoft.FSharp.Targets
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 | True
68 |
69 |
70 | ..\packages\Microsoft.AspNet.SignalR.Core.2.0.2\lib\net45\Microsoft.AspNet.SignalR.Core.dll
71 | True
72 |
73 |
74 | ..\packages\Microsoft.AspNet.SignalR.SystemWeb.2.0.2\lib\net45\Microsoft.AspNet.SignalR.SystemWeb.dll
75 | True
76 |
77 |
78 |
79 | ..\packages\Microsoft.Owin.2.1.0\lib\net45\Microsoft.Owin.dll
80 | True
81 |
82 |
83 | ..\packages\Microsoft.Owin.Cors.2.1.0\lib\net45\Microsoft.Owin.Cors.dll
84 | True
85 |
86 |
87 | ..\packages\Microsoft.Owin.Host.HttpListener.2.1.0\lib\net45\Microsoft.Owin.Host.HttpListener.dll
88 | True
89 |
90 |
91 | ..\packages\Microsoft.Owin.Host.SystemWeb.2.1.0\lib\net45\Microsoft.Owin.Host.SystemWeb.dll
92 | True
93 |
94 |
95 | ..\packages\Microsoft.Owin.Hosting.2.1.0\lib\net45\Microsoft.Owin.Hosting.dll
96 | True
97 |
98 |
99 | ..\packages\Microsoft.Owin.Security.2.1.0\lib\net45\Microsoft.Owin.Security.dll
100 | True
101 |
102 |
103 | ..\packages\Microsoft.Bcl.Async.1.0.165\lib\net45\Microsoft.Threading.Tasks.dll
104 | True
105 |
106 |
107 | ..\packages\Microsoft.Bcl.Async.1.0.165\lib\net45\Microsoft.Threading.Tasks.Extensions.dll
108 | True
109 |
110 |
111 |
112 | ..\packages\Newtonsoft.Json.5.0.8\lib\net45\Newtonsoft.Json.dll
113 | True
114 |
115 |
116 | ..\packages\Owin.1.0\lib\net40\Owin.dll
117 | True
118 |
119 |
120 |
121 |
122 |
123 |
124 |
125 | ..\packages\Rx-Core.2.2.2\lib\net45\System.Reactive.Core.dll
126 | True
127 |
128 |
129 | ..\packages\Rx-Interfaces.2.2.2\lib\net45\System.Reactive.Interfaces.dll
130 | True
131 |
132 |
133 | ..\packages\Rx-Linq.2.2.2\lib\net45\System.Reactive.Linq.dll
134 | True
135 |
136 |
137 | ..\packages\Rx-PlatformServices.2.2.3\lib\net45\System.Reactive.PlatformServices.dll
138 | True
139 |
140 |
141 |
142 | ..\packages\Microsoft.AspNet.Cors.5.1.0\lib\net45\System.Web.Cors.dll
143 | True
144 |
145 |
146 |
147 |
148 |
149 |
150 |
151 |
152 |
159 |
--------------------------------------------------------------------------------
/SignalRServer/TaskHelper.fs:
--------------------------------------------------------------------------------
1 | module TaskHelper
2 |
3 | open System.Threading.Tasks
4 | // Source code from: http://theburningmonk.com/2012/10/f-helper-functions-to-convert-between-asyncunit-and-task/
5 |
6 | []
7 | module Async =
8 | let inline awaitPlainTask (task: Task) =
9 | // rethrow exception from preceding task if it fauled
10 | let continuation (t : Task) : unit =
11 | match t.IsFaulted with
12 | | true -> raise t.Exception
13 | | arg -> ()
14 | task.ContinueWith continuation |> Async.AwaitTask
15 |
16 | let inline startAsPlainTask (work : Async) = Task.Factory.StartNew(fun () -> work |> Async.RunSynchronously)
--------------------------------------------------------------------------------
/SignalRServer/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
--------------------------------------------------------------------------------
/SignalRSilverlightClient/Interactive.fsx:
--------------------------------------------------------------------------------
1 | //Host path
2 | #r "System.Windows.dll"
3 |
4 | //Reactive Extensions:
5 | #r "System.ComponentModel.Composition.dll"
6 | #r "../packages/Rx-Interfaces.2.1.30214.0/lib/Net45/System.Reactive.Interfaces.dll"
7 | #r "../packages/Rx-Core.2.1.30214.0/lib/Net45/System.Reactive.Core.dll"
8 | #r "../packages/Rx-Linq.2.1.30214.0/lib/Net45/System.Reactive.Linq.dll"
9 |
10 | //SignalR Client:
11 | #r "../packages/Newtonsoft.Json.5.0.8/lib/net45/Newtonsoft.Json.dll"
12 | #r "../packages/Microsoft.AspNet.SignalR.Client.2.0.0/lib/net45/Microsoft.AspNet.SignalR.Client.dll"
13 |
14 | #load "SignalRSilverlightClient.fs"
15 | open SignalRSilverlightClient
16 |
17 |
18 | let client1 : Connection =
19 | MakePersistentConnection owinurl
20 |
21 | client1.ResultFeed |> Observable.subscribe System.Console.WriteLine
22 |
23 | let client2 : Connection =
24 | MakeHubConnection owinurl // [|box("hello there!")|]
25 |
26 | client2 |> Observable.subscribe System.Console.WriteLine
27 |
--------------------------------------------------------------------------------
/SignalRSilverlightClient/SignalRSilverlightClient.fs:
--------------------------------------------------------------------------------
1 | module SignalRSilverlightClient
2 |
3 | #if INTERACTIVE
4 | #else
5 | let aspnetUrl =
6 | let hs = System.Windows.Application.Current.Host.Source
7 | hs.Scheme + "://" + hs.Host + ":" + hs.Port.ToString();
8 | #endif
9 | let owinurl = "http://localhost:8080/"
10 |
11 | open Microsoft.AspNet.SignalR.Client
12 | open Microsoft.AspNet.SignalR.Client.Hubs
13 | open System
14 | open System.Linq
15 | open System.ComponentModel.Composition
16 | open System.Reactive.Subjects
17 | open System.Threading.Tasks
18 | open System.Threading
19 |
20 | type Connection = {SendRequest: Func; ResultFeed: IObservable}
21 |
22 | // SignalR supports two kinds of connections: Hub and PersistentConnection
23 |
24 | let MakePersistentConnection url =
25 |
26 | let gotResult = new Subject()
27 | let connection = new Microsoft.AspNet.SignalR.Client.Connection(url + "/signalrConn")
28 |
29 | connection.add_Received(fun r -> gotResult.OnNext(r))
30 | connection.add_Error(fun e -> gotResult.OnError(e))
31 | //connection.add_Reconnected(fun r -> ignore())
32 |
33 | let send msgToSend =
34 | // match connection.State with
35 | // | ConnectionState.Connected ->
36 | connection.Send(msgToSend)
37 |
38 | let handleExceptions (task:Task) =
39 | match task.Exception with
40 | | null -> "none" |> ignore
41 | | ex -> gotResult.OnError(ex.InnerExceptions.[0])
42 |
43 | connection.Start()
44 | .ContinueWith(handleExceptions, CancellationToken.None, TaskContinuationOptions.OnlyOnFaulted, TaskScheduler.Default)
45 | //.ContinueWith(Func(fun s -> connection.Send "hello there"))
46 | |> ignore
47 |
48 | {SendRequest = Func(send); ResultFeed = gotResult :> IObservable }
49 |
50 |
51 | // Hub uses JSON replies.
52 | open Newtonsoft.Json
53 | open Newtonsoft.Json.Linq
54 |
55 | let MakeHubConnection url =
56 |
57 | let gotResult = new Subject()
58 |
59 | //let connection = new HubConnection(url + "/signalrHub", TraceLevel = TraceLevels.All, TraceWriter = Console.Out, CookieContainer = new System.Net.CookieContainer())
60 | let connection = new HubConnection(url + "/signalrHub")
61 | let myhub = connection.CreateHubProxy("myhub")
62 |
63 | //myhub.Subscribe("myCustomClientFunction").add_Received(fun json -> json.[0].ToString() |> gotResult.OnNext)
64 | myhub.On("myCustomClientFunction", fun str -> str |> gotResult.OnNext) |> ignore
65 |
66 | //connection.add_Received(fun json -> JObject.Parse(json).["A"].First.ToString() |> gotResult.OnNext)
67 | connection.add_Error(fun e -> gotResult.OnError(e))
68 | //connection.add_Reconnected(fun r -> ignore())
69 |
70 | let invokeHub msgToSend =
71 | let param = box(msgToSend)
72 | myhub.Invoke("MyCustomServerFunction", param)
73 |
74 | let handleExceptions (task:Task) =
75 | match task.Exception with
76 | | null -> "none" |> ignore
77 | | ex -> gotResult.OnError(ex.InnerExceptions.[0])
78 |
79 | connection.Start()
80 | .ContinueWith(handleExceptions, CancellationToken.None, TaskContinuationOptions.OnlyOnFaulted, TaskScheduler.Default)
81 | //.ContinueWith(Func(fun _ -> invokeHub "Hello there!"))
82 | |> ignore
83 |
84 | {SendRequest = Func(invokeHub); ResultFeed = gotResult :> IObservable }
85 |
--------------------------------------------------------------------------------
/SignalRSilverlightClient/SignalRSilverlightClient.fsproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Debug
6 | AnyCPU
7 | 2.0
8 | 3be39cbe-6f97-4d0f-b559-bb065562bef6
9 | Library
10 | SignalRSilverlightClient
11 | v5.0
12 | $(TargetFrameworkVersion)
13 | 512
14 | true
15 | {A1591282-1198-4647-A2B1-27E5FF5F6F3B};{f2a71f9b-5d33-465a-a702-920d77279786}
16 | SignalRSilverlightClient
17 | Silverlight
18 | false
19 | true
20 | false
21 | ..\
22 | true
23 | 2.3.5.0
24 |
25 |
26 | true
27 | full
28 | false
29 | bin\Debug\
30 | DEBUG;TRACE;SILVERLIGHT
31 | prompt
32 | 3
33 | bin\Debug\SignalRSilverlightClient.XML
34 |
35 |
36 | pdbonly
37 | true
38 | bin\Release\
39 | TRACE;SILVERLIGHT
40 | prompt
41 | 3
42 | bin\Release\SignalRSilverlightClient.XML
43 |
44 |
45 |
46 | $(MSBuildExtensionsPath32)\..\Reference Assemblies\Microsoft\FSharp\.NETPortable\$(TargetFSharpCoreVersion)\FSharp.Core.dll
47 | True
48 |
49 |
50 | ..\packages\Microsoft.AspNet.SignalR.Client.2.0.2\lib\portable-net45+sl5+netcore45+wp8\Microsoft.AspNet.SignalR.Client.dll
51 | True
52 |
53 |
54 | ..\packages\Microsoft.Bcl.Async.1.0.165\lib\sl4\Microsoft.Threading.Tasks.dll
55 | True
56 |
57 |
58 | ..\packages\Microsoft.Bcl.Async.1.0.165\lib\sl4\Microsoft.Threading.Tasks.Extensions.dll
59 | True
60 |
61 |
62 | ..\packages\Microsoft.Bcl.Async.1.0.165\lib\sl4\Microsoft.Threading.Tasks.Extensions.Silverlight.dll
63 | True
64 |
65 |
66 |
67 | ..\packages\Newtonsoft.Json.5.0.8\lib\portable-net40+sl4+wp7+win8\Newtonsoft.Json.dll
68 | True
69 |
70 |
71 |
72 |
73 |
74 | ..\packages\Microsoft.Bcl.1.1.6\lib\sl5\System.IO.dll
75 | True
76 |
77 |
78 |
79 | ..\packages\Microsoft.Net.Http.2.2.18\lib\portable-net40+sl4+win8+wp71\System.Net.Http.dll
80 | True
81 |
82 |
83 | ..\packages\Microsoft.Net.Http.2.2.18\lib\portable-net40+sl4+win8+wp71\System.Net.Http.Extensions.dll
84 | True
85 |
86 |
87 | ..\packages\Microsoft.Net.Http.2.2.18\lib\portable-net40+sl4+win8+wp71\System.Net.Http.Primitives.dll
88 | True
89 |
90 |
91 | ..\packages\Rx-Core.2.2.2\lib\sl5\System.Reactive.Core.dll
92 | True
93 |
94 |
95 | ..\packages\Rx-Interfaces.2.2.2\lib\sl5\System.Reactive.Interfaces.dll
96 | True
97 |
98 |
99 | ..\packages\Rx-Linq.2.2.2\lib\sl5\System.Reactive.Linq.dll
100 | True
101 |
102 |
103 | ..\packages\Rx-PlatformServices.2.2.3\lib\sl5\System.Reactive.PlatformServices.dll
104 | True
105 |
106 |
107 | ..\packages\Rx-XAML.2.2.2\lib\sl5\System.Reactive.Windows.Threading.dll
108 | True
109 |
110 |
111 | ..\packages\Microsoft.Bcl.1.1.6\lib\sl5\System.Runtime.dll
112 | True
113 |
114 |
115 | ..\packages\Microsoft.Bcl.1.1.6\lib\sl5\System.Threading.Tasks.dll
116 | True
117 |
118 |
119 |
120 |
121 |
122 |
123 |
124 |
125 |
126 |
127 |
128 | 11
129 |
130 |
131 |
132 |
133 | $(MSBuildExtensionsPath32)\..\Microsoft SDKs\F#\3.0\Framework\v4.0\Microsoft.FSharp.Targets
134 |
135 |
136 |
137 |
138 | $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)\FSharp\Microsoft.FSharp.Targets
139 |
140 |
141 |
142 |
143 |
144 |
145 |
152 |
--------------------------------------------------------------------------------
/SignalRSilverlightClient/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
--------------------------------------------------------------------------------
/SilverlightTestUI/App.xaml:
--------------------------------------------------------------------------------
1 |
5 |
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/SilverlightTestUI/App.xaml.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Windows;
3 |
4 | namespace SilverlightTestUI
5 | {
6 | public partial class App : Application
7 | {
8 |
9 | public App()
10 | {
11 | this.Startup += this.Application_Startup;
12 | this.Exit += this.Application_Exit;
13 | this.UnhandledException += this.Application_UnhandledException;
14 |
15 | InitializeComponent();
16 | }
17 |
18 | private void Application_Startup(object sender, StartupEventArgs e)
19 | {
20 | this.RootVisual = new MainPage();
21 | }
22 |
23 | private void Application_Exit(object sender, EventArgs e)
24 | {
25 |
26 | }
27 |
28 | private void Application_UnhandledException(object sender, ApplicationUnhandledExceptionEventArgs e)
29 | {
30 | // If the app is running outside of the debugger then report the exception using
31 | // the browser's exception mechanism. On IE this will display it a yellow alert
32 | // icon in the status bar and Firefox will display a script error.
33 | if (!System.Diagnostics.Debugger.IsAttached)
34 | {
35 |
36 | // NOTE: This will allow the application to continue running after an exception has been thrown
37 | // but not handled.
38 | // For production applications this error handling should be replaced with something that will
39 | // report the error to the website and stop the application.
40 | e.Handled = true;
41 | Deployment.Current.Dispatcher.BeginInvoke(delegate { ReportErrorToDOM(e); });
42 | }
43 | }
44 |
45 | private void ReportErrorToDOM(ApplicationUnhandledExceptionEventArgs e)
46 | {
47 | try
48 | {
49 | string errorMsg = e.ExceptionObject.Message + e.ExceptionObject.StackTrace;
50 | errorMsg = errorMsg.Replace('"', '\'').Replace("\r\n", @"\n");
51 |
52 | System.Windows.Browser.HtmlPage.Window.Eval("throw new Error(\"Unhandled Error in Silverlight Application " + errorMsg + "\");");
53 | }
54 | catch (Exception)
55 | {
56 | }
57 | }
58 | }
59 | }
60 |
--------------------------------------------------------------------------------
/SilverlightTestUI/MainPage.xaml:
--------------------------------------------------------------------------------
1 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
--------------------------------------------------------------------------------
/SilverlightTestUI/MainPage.xaml.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.ObjectModel;
3 | using System.Reactive.Concurrency;
4 | using System.Reactive.Linq;
5 | using System.Windows.Controls;
6 |
7 | namespace SilverlightTestUI
8 | {
9 | public partial class MainPage : UserControl
10 | {
11 | private readonly SignalRSilverlightClient.Connection connection;
12 |
13 | public MainPage()
14 | {
15 | InitializeComponent();
16 |
17 | var source = new ObservableCollection();
18 | ResultBox.ItemsSource = source;
19 |
20 | //Use Hub or PersistentConnection:
21 | //connection = SignalRSilverlightClient.MakePersistentConnection(SignalRSilverlightClient.aspnetUrl);
22 | connection = SignalRSilverlightClient.MakeHubConnection(SignalRSilverlightClient.aspnetUrl);
23 | source.Add("Signal-R Test UI:");
24 |
25 | connection.ResultFeed.ObserveOnDispatcher().Subscribe(
26 | onNext: r => source.Add(r),
27 | onError: e => source.Add(e.ToString()));
28 | }
29 |
30 | private void Send_Click(object sender, System.Windows.RoutedEventArgs e)
31 | {
32 | connection.SendRequest(InputText.Text);
33 | }
34 | }
35 | }
--------------------------------------------------------------------------------
/SilverlightTestUI/Properties/AppManifest.xml:
--------------------------------------------------------------------------------
1 |
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/SilverlightTestUI/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.CompilerServices;
3 | using System.Runtime.InteropServices;
4 |
5 | // General Information about an assembly is controlled through the following
6 | // set of attributes. Change these attribute values to modify the information
7 | // associated with an assembly.
8 | [assembly: AssemblyTitle("SilverlightTestUI")]
9 | [assembly: AssemblyDescription("Example of SignalR 1.1.1 with F-Sharp and Silverlight 5")]
10 | [assembly: AssemblyConfiguration("")]
11 | [assembly: AssemblyCompany("")]
12 | [assembly: AssemblyProduct("SilverlightTestUI")]
13 | [assembly: AssemblyCopyright("Copyright © Tuomas Hietanen 2013, LGPLv3")]
14 | [assembly: AssemblyTrademark("")]
15 | [assembly: AssemblyCulture("")]
16 |
17 | // Setting ComVisible to false makes the types in this assembly not visible
18 | // to COM components. If you need to access a type in this assembly from
19 | // COM, set the ComVisible attribute to true on that type.
20 | [assembly: ComVisible(false)]
21 | [assembly: System.CLSCompliant(false)]
22 |
23 | // The following GUID is for the ID of the typelib if this project is exposed to COM
24 | [assembly: Guid("25e1347b-c896-4440-8c57-3557535df4ca")]
25 |
26 | // Version information for an assembly consists of the following four values:
27 | //
28 | // Major Version
29 | // Minor Version
30 | // Build Number
31 | // Revision
32 | //
33 | // You can specify all the values or you can default the Revision and Build Numbers
34 | // by using the '*' as shown below:
35 | [assembly: AssemblyVersion("1.0.0.0")]
36 | [assembly: AssemblyFileVersion("1.0.0.0")]
37 |
--------------------------------------------------------------------------------
/SilverlightTestUI/SilverlightTestUI.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Debug
5 | AnyCPU
6 | 8.0.50727
7 | 2.0
8 | {25E1347B-C896-4440-8C57-3557535DF4CA}
9 | {A1591282-1198-4647-A2B1-27E5FF5F6F3B};{fae04ec0-301f-11d3-bf4b-00c04f79efbc}
10 | Library
11 | Properties
12 | SilverlightTestUI
13 | SilverlightTestUI
14 | Silverlight
15 | v5.0
16 | $(TargetFrameworkVersion)
17 | true
18 |
19 |
20 | true
21 | true
22 | SilverlightTestUI.xap
23 | Properties\AppManifest.xml
24 | SilverlightTestUI.App
25 | SilverlightTestUITestPage.html
26 | true
27 | true
28 | false
29 | Properties\OutOfBrowserSettings.xml
30 | false
31 | true
32 |
33 |
34 | ..\
35 | true
36 |
37 |
40 |
41 | v3.5
42 |
43 |
44 | true
45 | full
46 | false
47 | Bin\Debug\
48 | DEBUG;TRACE;SILVERLIGHT
49 | true
50 | true
51 | prompt
52 | 4
53 | true
54 |
55 |
56 | pdbonly
57 | true
58 | Bin\Release
59 | TRACE;SILVERLIGHT
60 | true
61 | true
62 | prompt
63 | 4
64 |
65 |
66 |
67 | False
68 | ..\packages\Microsoft.Bcl.Async.1.0.165\lib\sl4\Microsoft.Threading.Tasks.dll
69 |
70 |
71 | False
72 | ..\packages\Microsoft.Bcl.Async.1.0.165\lib\sl4\Microsoft.Threading.Tasks.Extensions.dll
73 |
74 |
75 | False
76 | ..\packages\Microsoft.Bcl.Async.1.0.165\lib\sl4\Microsoft.Threading.Tasks.Extensions.Silverlight.dll
77 |
78 |
79 |
80 | False
81 | ..\packages\Newtonsoft.Json.5.0.8\lib\portable-net40+sl4+wp7+win8\Newtonsoft.Json.dll
82 | True
83 |
84 |
85 | False
86 | ..\packages\Microsoft.Bcl.1.1.6\lib\sl5\System.IO.dll
87 |
88 |
89 | False
90 | ..\packages\Rx-Core.2.2.2\lib\sl5\System.Reactive.Core.dll
91 |
92 |
93 | False
94 | ..\packages\Rx-Interfaces.2.2.2\lib\sl5\System.Reactive.Interfaces.dll
95 |
96 |
97 | False
98 | ..\packages\Rx-Linq.2.2.2\lib\sl5\System.Reactive.Linq.dll
99 |
100 |
101 | ..\packages\Rx-PlatformServices.2.2.3\lib\sl5\System.Reactive.PlatformServices.dll
102 |
103 |
104 | ..\packages\Rx-XAML.2.2.2\lib\sl5\System.Reactive.Windows.Threading.dll
105 |
106 |
107 | False
108 | ..\packages\Microsoft.Bcl.1.1.6\lib\sl5\System.Runtime.dll
109 |
110 |
111 |
112 | False
113 | ..\packages\Microsoft.Bcl.1.1.6\lib\sl5\System.Threading.Tasks.dll
114 |
115 |
116 |
117 |
118 | $(TargetFrameworkDirectory)System.Core.dll
119 |
120 |
121 |
122 |
123 |
124 |
125 |
126 | App.xaml
127 |
128 |
129 | MainPage.xaml
130 |
131 |
132 |
133 |
134 |
135 | Designer
136 | MSBuild:Compile
137 |
138 |
139 | Designer
140 | MSBuild:Compile
141 |
142 |
143 |
144 |
145 |
146 |
147 |
148 |
149 | {3be39cbe-6f97-4d0f-b559-bb065562bef6}
150 | SignalRSilverlightClient
151 |
152 |
153 |
154 |
161 |
162 |
163 |
164 |
165 |
166 |
167 |
168 |
169 |
170 |
171 |
172 |
173 |
174 |
--------------------------------------------------------------------------------
/SilverlightTestUI/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
--------------------------------------------------------------------------------
/WebApp/Global.asax:
--------------------------------------------------------------------------------
1 | <%@ Application Codebehind="Global.asax.cs" Inherits="WebApp.Global" Language="C#" %>
2 |
--------------------------------------------------------------------------------
/WebApp/Global.asax.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace WebApp
4 | {
5 | public class Global : System.Web.HttpApplication
6 | {
7 | protected void Application_Start(object sender, EventArgs e)
8 | {
9 | //SignalR-1.1.3:
10 | //SignalRServer.MyServer.SetupRouting();
11 | }
12 |
13 | protected void Session_Start(object sender, EventArgs e){}
14 | protected void Application_BeginRequest(object sender, EventArgs e){}
15 | protected void Application_AuthenticateRequest(object sender, EventArgs e){}
16 | protected void Application_Error(object sender, EventArgs e){}
17 | protected void Session_End(object sender, EventArgs e){}
18 | protected void Application_End(object sender, EventArgs e){}
19 | }
20 | }
--------------------------------------------------------------------------------
/WebApp/JavaScriptTestUITestPage.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | JavascriptTestUI
5 |
6 |
7 |
8 |
9 |
10 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
--------------------------------------------------------------------------------
/WebApp/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.CompilerServices;
3 | using System.Runtime.InteropServices;
4 |
5 | // General Information about an assembly is controlled through the following
6 | // set of attributes. Change these attribute values to modify the information
7 | // associated with an assembly.
8 | [assembly: AssemblyTitle("WebApp")]
9 | [assembly: AssemblyDescription("Example of SignalR 1.1.1 with F-Sharp and Silverlight 5")]
10 | [assembly: AssemblyConfiguration("")]
11 | [assembly: AssemblyCompany("")]
12 | [assembly: AssemblyProduct("WebApp")]
13 | [assembly: AssemblyCopyright("Copyright © Tuomas Hietanen 2013, LGPLv3")]
14 | [assembly: AssemblyTrademark("")]
15 | [assembly: AssemblyCulture("")]
16 |
17 | // Setting ComVisible to false makes the types in this assembly not visible
18 | // to COM components. If you need to access a type in this assembly from
19 | // COM, set the ComVisible attribute to true on that type.
20 | [assembly: ComVisible(false)]
21 | [assembly: System.CLSCompliant(false)]
22 |
23 | // The following GUID is for the ID of the typelib if this project is exposed to COM
24 | [assembly: Guid("2b125df3-a76b-44a0-816f-0911f313dd0f")]
25 |
26 | // Version information for an assembly consists of the following four values:
27 | //
28 | // Major Version
29 | // Minor Version
30 | // Build Number
31 | // Revision
32 | //
33 | // You can specify all the values or you can default the Revision and Build Numbers
34 | // by using the '*' as shown below:
35 | [assembly: AssemblyVersion("1.0.0.0")]
36 | [assembly: AssemblyFileVersion("1.0.0.0")]
37 |
--------------------------------------------------------------------------------
/WebApp/Silverlight.js:
--------------------------------------------------------------------------------
1 | //v2.0.30511.0
2 | if(!window.Silverlight)window.Silverlight={};Silverlight._silverlightCount=0;Silverlight.__onSilverlightInstalledCalled=false;Silverlight.fwlinkRoot="http://go2.microsoft.com/fwlink/?LinkID=";Silverlight.__installationEventFired=false;Silverlight.onGetSilverlight=null;Silverlight.onSilverlightInstalled=function(){window.location.reload(false)};Silverlight.isInstalled=function(b){if(b==undefined)b=null;var a=false,m=null;try{var i=null,j=false;if(window.ActiveXObject)try{i=new ActiveXObject("AgControl.AgControl");if(b===null)a=true;else if(i.IsVersionSupported(b))a=true;i=null}catch(l){j=true}else j=true;if(j){var k=navigator.plugins["Silverlight Plug-In"];if(k)if(b===null)a=true;else{var h=k.description;if(h==="1.0.30226.2")h="2.0.30226.2";var c=h.split(".");while(c.length>3)c.pop();while(c.length<4)c.push(0);var e=b.split(".");while(e.length>4)e.pop();var d,g,f=0;do{d=parseInt(e[f]);g=parseInt(c[f]);f++}while(f");delete a.id;delete a.width;delete a.height;for(var c in a)if(a[c])b.push('');b.push("");return b.join("")};Silverlight.createObjectEx=function(b){var a=b,c=Silverlight.createObject(a.source,a.parentElement,a.id,a.properties,a.events,a.initParams,a.context);if(a.parentElement==null)return c};Silverlight.buildPromptHTML=function(b){var a="",d=Silverlight.fwlinkRoot,c=b.version;if(b.alt)a=b.alt;else{if(!c)c="";a="
";a=a.replace("{1}",c);a=a.replace("{2}",d+"108181")}return a};Silverlight.getSilverlight=function(e){if(Silverlight.onGetSilverlight)Silverlight.onGetSilverlight();var b="",a=String(e).split(".");if(a.length>1){var c=parseInt(a[0]);if(isNaN(c)||c<2)b="1.0";else b=a[0]+"."+a[1]}var d="";if(b.match(/^\d+\056\d+$/))d="&v="+b;Silverlight.followFWLink("149156"+d)};Silverlight.followFWLink=function(a){top.location=Silverlight.fwlinkRoot+String(a)};Silverlight.HtmlAttributeEncode=function(c){var a,b="";if(c==null)return null;for(var d=0;d96&&a<123||a>64&&a<91||a>43&&a<58&&a!=47||a==95)b=b+String.fromCharCode(a);else b=b+""+a+";"}return b};Silverlight.default_error_handler=function(e,b){var d,c=b.ErrorType;d=b.ErrorCode;var a="\nSilverlight error message \n";a+="ErrorCode: "+d+"\n";a+="ErrorType: "+c+" \n";a+="Message: "+b.ErrorMessage+" \n";if(c=="ParserError"){a+="XamlFile: "+b.xamlFile+" \n";a+="Line: "+b.lineNumber+" \n";a+="Position: "+b.charPosition+" \n"}else if(c=="RuntimeError"){if(b.lineNumber!=0){a+="Line: "+b.lineNumber+" \n";a+="Position: "+b.charPosition+" \n"}a+="MethodName: "+b.methodName+" \n"}alert(a)};Silverlight.__cleanup=function(){for(var a=Silverlight._silverlightCount-1;a>=0;a--)window["__slEvent"+a]=null;Silverlight._silverlightCount=0;if(window.removeEventListener)window.removeEventListener("unload",Silverlight.__cleanup,false);else window.detachEvent("onunload",Silverlight.__cleanup)};Silverlight.__getHandlerName=function(b){var a="";if(typeof b=="string")a=b;else if(typeof b=="function"){if(Silverlight._silverlightCount==0)if(window.addEventListener)window.addEventListener("onunload",Silverlight.__cleanup,false);else window.attachEvent("onunload",Silverlight.__cleanup);var c=Silverlight._silverlightCount++;a="__slEvent"+c;window[a]=b}else a=null;return a};Silverlight.onRequiredVersionAvailable=function(){};Silverlight.onRestartRequired=function(){};Silverlight.onUpgradeRequired=function(){};Silverlight.onInstallRequired=function(){};Silverlight.IsVersionAvailableOnError=function(d,a){var b=false;try{if(a.ErrorCode==8001&&!Silverlight.__installationEventFired){Silverlight.onUpgradeRequired();Silverlight.__installationEventFired=true}else if(a.ErrorCode==8002&&!Silverlight.__installationEventFired){Silverlight.onRestartRequired();Silverlight.__installationEventFired=true}else if(a.ErrorCode==5014||a.ErrorCode==2106){if(Silverlight.__verifySilverlight2UpgradeSuccess(a.getHost()))b=true}else b=true}catch(c){}return b};Silverlight.IsVersionAvailableOnLoad=function(b){var a=false;try{if(Silverlight.__verifySilverlight2UpgradeSuccess(b.getHost()))a=true}catch(c){}return a};Silverlight.__verifySilverlight2UpgradeSuccess=function(d){var c=false,b="2.0.31005",a=null;try{if(d.IsVersionSupported(b+".99")){a=Silverlight.onRequiredVersionAvailable;c=true}else if(d.IsVersionSupported(b+".0"))a=Silverlight.onRestartRequired;else a=Silverlight.onUpgradeRequired;if(a&&!Silverlight.__installationEventFired){a();Silverlight.__installationEventFired=true}}catch(e){}return c}
--------------------------------------------------------------------------------
/WebApp/SilverlightTestUITestPage.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | SilverlightTestUI
6 |
20 |
21 |
57 |
58 |
59 |
72 |
73 |
74 |
--------------------------------------------------------------------------------
/WebApp/Web.Debug.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
17 |
18 |
29 |
30 |
--------------------------------------------------------------------------------
/WebApp/Web.Release.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
17 |
18 |
19 |
30 |
31 |
--------------------------------------------------------------------------------
/WebApp/Web.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
--------------------------------------------------------------------------------
/WebApp/WebApp.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Debug
6 | AnyCPU
7 |
8 |
9 | 2.0
10 | {0CEF79E9-0A53-40A5-829B-B9EA7EBFAE54}
11 | {349c5851-65df-11da-9384-00065b846f21};{fae04ec0-301f-11d3-bf4b-00c04f79efbc}
12 | Library
13 | Properties
14 | WebApp
15 | WebApp
16 | v4.5
17 | true
18 |
19 |
20 |
21 |
22 | {25e1347b-c896-4440-8c57-3557535df4ca}|SilverlightTestUI\SilverlightTestUI.csproj|ClientBin|False
23 | ..\
24 | true
25 |
26 |
27 | true
28 | full
29 | false
30 | bin\
31 | DEBUG;TRACE
32 | prompt
33 | 4
34 | true
35 |
36 |
37 | pdbonly
38 | true
39 | bin\
40 | TRACE
41 | prompt
42 | 4
43 |
44 |
45 |
46 | False
47 | ..\packages\Microsoft.AspNet.SignalR.Core.2.0.2\lib\net45\Microsoft.AspNet.SignalR.Core.dll
48 |
49 |
50 | False
51 | ..\packages\Microsoft.AspNet.SignalR.SystemWeb.2.0.2\lib\net45\Microsoft.AspNet.SignalR.SystemWeb.dll
52 |
53 |
54 |
55 | False
56 | ..\packages\Microsoft.Owin.2.1.0\lib\net45\Microsoft.Owin.dll
57 |
58 |
59 | False
60 | ..\packages\Microsoft.Owin.Cors.2.1.0\lib\net45\Microsoft.Owin.Cors.dll
61 |
62 |
63 | False
64 | ..\packages\Microsoft.Owin.Host.SystemWeb.2.1.0\lib\net45\Microsoft.Owin.Host.SystemWeb.dll
65 |
66 |
67 | False
68 | ..\packages\Microsoft.Owin.Security.2.1.0\lib\net45\Microsoft.Owin.Security.dll
69 |
70 |
71 | False
72 | ..\packages\Microsoft.Bcl.Async.1.0.165\lib\net45\Microsoft.Threading.Tasks.dll
73 |
74 |
75 | False
76 | ..\packages\Microsoft.Bcl.Async.1.0.165\lib\net45\Microsoft.Threading.Tasks.Extensions.dll
77 |
78 |
79 | False
80 | ..\packages\Newtonsoft.Json.5.0.8\lib\net45\Newtonsoft.Json.dll
81 |
82 |
83 | ..\packages\Owin.1.0\lib\net40\Owin.dll
84 |
85 |
86 |
87 | False
88 | ..\packages\Microsoft.AspNet.Cors.5.1.0\lib\net45\System.Web.Cors.dll
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 |
107 |
108 |
109 |
110 |
111 |
112 |
113 |
114 |
115 |
116 |
117 |
118 |
119 | Global.asax
120 |
121 |
122 |
123 |
124 |
125 |
126 | Web.config
127 |
128 |
129 | Web.config
130 |
131 |
132 |
133 |
134 | {b79d6d3c-23fa-4d27-aead-dc2391000220}
135 | SignalRServer
136 |
137 |
138 |
139 | 10.0
140 | $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)
141 |
142 |
143 |
144 |
145 |
146 |
147 |
148 |
149 | True
150 | True
151 | 0
152 | /
153 | http://localhost:49328/
154 | False
155 | False
156 |
157 |
158 | False
159 |
160 |
161 |
162 |
163 |
164 |
165 |
166 |
167 |
168 |
169 |
176 |
--------------------------------------------------------------------------------
/WebApp/clientaccesspolicy.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/WebApp/crossdomain.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/WebApp/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
--------------------------------------------------------------------------------