C
C#10mo ago
AceChewy

❔ Creating a server for a messaging app

For a messaging app I'm developing, I've created a contacts collection (code below) which will contain contact items which correspond to a different user, this includes the other user's Username, Profile picture and the most recent message in the chat between you and said user. However I'm not sure how to create a server which will store this information and then call said information. (This will have to come later but I think once the server is created, I'll first have to create a sign up option to the application when it's first launched and will ask the user to input a Username, Email and Profile picture (which can then be changed in a settings tab))
using Solaris.MVVM.Model;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Solaris.MVVM.ViewModel
{
class MainViewModel
{
public ObservableCollection<MessagesModel> Messages { get; set; }
public ObservableCollection<ContactsModel> Contacts { get; set; }
public MainViewModel()
{
Messages = new ObservableCollection<MessagesModel>();
Contacts = new ObservableCollection<ContactsModel>();

Messages.Add(new MessagesModel
{

});
}
}
}
using Solaris.MVVM.Model;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Solaris.MVVM.ViewModel
{
class MainViewModel
{
public ObservableCollection<MessagesModel> Messages { get; set; }
public ObservableCollection<ContactsModel> Contacts { get; set; }
public MainViewModel()
{
Messages = new ObservableCollection<MessagesModel>();
Contacts = new ObservableCollection<ContactsModel>();

Messages.Add(new MessagesModel
{

});
}
}
}
15 Replies
Azrael
Azrael10mo ago
You'd need a database for this & an API. You can use JWT to ensure that only authenticated users can access certain endpoints.
AceChewy
AceChewy10mo ago
Yh that was my first thought, I'd appreciate recommondations
Azrael
Azrael10mo ago
ASP.NET Core for your server. MongoDB - NoSQL or PostgreSQL - SQL for your database. RESTful API, can be done with ASP.NET.
AceChewy
AceChewy10mo ago
Mind briefly explaining what RESTful API is?
Azrael
Azrael10mo ago
Sure.
AceChewy
AceChewy10mo ago
Also would this be compatible with my app which is WPF (.NET framework)?
Azrael
Azrael10mo ago
A RESTful API (Representational State Transfer) is an architectural style for designing networked applications. It relies on stateless, client-server communication, meaning that server requests from any client are treated as new and no context is stored between requests.
https://restfulapi.net/
REST API Tutorial
What is REST - REST API Tutorial
REST is an acronym for REpresentational State Transfer. It is an architectural style for hypermedia systems and was first presented by Roy Fielding.
Azrael
Azrael10mo ago
Yeah. HttpClient can be used to make requests.
AceChewy
AceChewy10mo ago
Right, so do I create a seperate project in ASP.NET Core to create a server and then use RESTful to connect my app to the server?
Azrael
Azrael10mo ago
You can do that yeah.
AceChewy
AceChewy10mo ago
Cool I guess all that's left now (understatement) is to watch some videos and look over guides to understand how to get this to work
Azrael
Azrael10mo ago
AceChewy
AceChewy10mo ago
Thanks
Pedro
Pedro10mo ago
😍 😍 😍 😍 😍
Accord
Accord10mo ago
Was this issue resolved? If so, run /close - otherwise I will mark this as stale and this post will be archived until there is new activity.
Want results from more Discord servers?
Add your server
More Posts