Saturday, November 5, 2016

Backend Architecture

I'm planning out the overall design of the project currently. While I haven't committed to anything frontend-wise yet I am 99% sure that I will be using the current release of Angular 2 and SignalR for those. However, the decision as to what technology to use for the backend is much more difficult. I know that I will be using ASP.NET, but there are many different versions available. I'm not too experienced with ASP.NET (I've made a few small websites and used the MVC framework before, but never done a large project in it) and as such picking a version to target has been tough.

Firstly, it needs to work with the current VLC system. Until I get access to the SVN server with the source code on I can't know what version of the .NET framework is being used, but I'm going to guess one of the 4.5.x versions. As such, I'd like to target these versions of the .NET framework.

Secondly, my laptop is running a Linux distro, and it would be huge plus for me if I could do some development on my laptop (in the library or at the Digital Greenwich offices in North Greenwich). Recently, the .NET Core has been released which is actually available for Linux, so I jumped on that straight away. The .NET Core doesn't have a lot of the fancy things that the .NET Framework has, and this would mean having a very lightweight application but that is what I'd like to go for anyway.

Unfortunately, after doing some exploration I found that the SignalR package for ASP.NET Core isn't getting a proper release until Q1 2017. I'd like to avoid using preview builds of a software as the backbone of a production application so unfortunately using .NET Core is out of the question. I could still develop on my laptop using Mono, but I've never had much luck with Mono in the past so I'll probably just give up on that and do the backend entirely on my desktop PC.

I wanted to run the messenger server as a plugin to the current server, so that the main developer just has to reference my class library, enter some config info and run it. Unfortunately, without access to the SVN server with the code on, I don't think this will be possible. ASP.NET's middle-ware configuration varies wildly from framework to framework. The OWIN configuration for an MVC project would be very different to a WebForms project, and that very different to the many possible ways of implementing it in a project without a framework. I've been told that I might get access soon, but I'd like to start development ASAP and this is such a large part of the server architecture that I can't really start the design until I've decided on this.

I spent a long time trying to figure out how to get CORS (Cross Origin Resource Sharing) working with SignalR. It doesn't play particularly nice with having a different hub server to the html server, but I managed to get it working. For a while it looked impossible, and I briefly considered consolidating the backend and the frontend into one application but I managed to get CORS to work. I would very much prefer to have the front and back end seperated as much as possible to make

So with all this considered, the base for my backend is pretty much decided. I'll be using an ASP.NET WebAPI targeting the .NET Framework 4.5.X (probably 4.5.2 unless I need features from more recent releases). This will provide login, a list of chats the user is in, the messages in any of those chats, an interface to send messages to, etc.

With all this sorted, I'm ready to begin work on designing the backend in more detail.