Recent

Author Topic: Application like Spotify or Discord  (Read 3731 times)

nicanor

  • New Member
  • *
  • Posts: 17
Application like Spotify or Discord
« on: March 28, 2022, 09:44:56 pm »
Actually I don't know if this make sense ... 
I want to create an application that looks and woks like Spotify ... But I don't want to make a music player or something like that... I just talk about the nature or structure of Spotify...
I was thinking that this kind of application runs in its "own browser"  maybe using something like CEF (Chromium Embedded Framework) ... Anyway ... Am i wrong about this? I mean ... can somebody put me on right direction?
For example: Can I use CEF4Delphi and Pas2Js together, to achieve success in create a client application that have its own interface, independent of firefox, chrome etc ... i.e. An application like discord or spotify? I believe this applications have a server site, a webserver or something...
I'm sorry if this appear strange... but I don't know the correct terminologies that we can use in this case.

Warfley

  • Hero Member
  • *****
  • Posts: 1499
Re: Application like Spotify or Discord
« Reply #1 on: March 29, 2022, 12:43:02 am »
Spotify, at least the desktop app (there is also the web app and the smart TV app and the mobile App, etc.) is based on CEF. But, the main reason for this is that in 2007/8 when it was released, there were no real alternatives to using browser interfaces for your application. But today there are many. You could use Electron, React Native, Cordova and many more. So you are free to choose. Pas2JS is a general Pascal to Javascript Transpiler and should work with all of those platforms.

If your application requires a backend (like Spotify to stream the music), you of course need to have some sort of Server. While native frameworks like Electron (which use nodejs rather than browser js) provide full access to the network stack and allow you to basically choose any protocol you want. If you are bound by more traditional web applications (i.e. those that should run also in a simple browser), you are restricted to only HTTP or Websocket traffic, where HTTP is a basic request response format (which none the less has been (ab)used for any kind of transmission, because transmitting kilobytes of data for a simple "OK" message is fun), while Websockets allows to send arbitrary messages in both directions at any time.

So there is a wide variety on technologies and protocols you could use. Without any more information on what you are trying to archive (which platforms you target, what kind of service you want to provide, etc). it is hard to give you any specific information

nicanor

  • New Member
  • *
  • Posts: 17
Re: Application like Spotify or Discord
« Reply #2 on: March 29, 2022, 01:15:30 am »
Thank you so much for the information... This already helps to start clearing the way!

I intend to build an operations management system to control projects and activities in the operations sector of a company.

Currently, we are even using Grafana to present dashboards, plot graphs and present indicators. But I just want to implement my system based on this idea.

For that I get the data in a database of an old system that we have running here... (made in delphi7)... but I need to evolve from this old technology... to effectively create a new application.

That is, the face of the system will be based on dashboards presenting synthetic data, graphs and indicators of production and project status, activities in progress and the results of the operations sector.

I will implement interfaces for engineers and technicians to register, update and monitor projects in progress, appointments, schedules and tasks in progress... In the end we will have a mix of "project manager and productivity control".. .only functional and specific to our case.

I intend to store the data (the CRUD of this system (I'm thinking this would be the server side)) using Firebird or Postgres. And I want to apply what I've been learning, evolving and practicing for a few years in terms of Clean Architecture, SOLID, DDD, TDD development best practices.

nicanor

  • New Member
  • *
  • Posts: 17
Re: Application like Spotify or Discord
« Reply #3 on: March 29, 2022, 01:26:29 am »
I work with pascal and want to continue in that line.
The problem is that I'm kind of lost among the various possibilities for web available on lazarus... We have weblaz, CEF4Delphi, Pas2JS, fastplaz...
I follow the forums where people defend the advantages of use fastCGI ...  :) ...
At the end of the day, there's a lot of information and a lot of opinion and we don't have a place to start... and without a clear idea of how to structure all this knowledge and effectively be able to use it objectively...
Sorry... this has nothing to do with the case...
I'm just explaining this with the intention that someone more experienced can point me in the right direction..or at least in the best possible direction...
Thank you very much!

PierceNg

  • Sr. Member
  • ****
  • Posts: 373
    • SamadhiWeb
Re: Application like Spotify or Discord
« Reply #4 on: March 29, 2022, 01:55:25 am »
I was thinking that this kind of application runs in its "own browser"  maybe using something like CEF (Chromium Embedded Framework) ... Anyway ... Am i wrong about this? I mean ... can somebody put me on right direction?
For example: Can I use CEF4Delphi and Pas2Js together, to achieve success in create a client application that have its own interface, independent of firefox, chrome etc ... i.e. An application like discord or spotify? I believe this applications have a server site, a webserver or something...
I'm sorry if this appear strange... but I don't know the correct terminologies that we can use in this case.

Take a look at fpwebview - an FPC binding for Webview, which is a tiny cross-platform library for building modern cross-platform GUIs using web technology. Webview uses GTK WebKit, Cocoa WebKit and MS WebView2 on Linux, macOS and Windows respectively.

There is an example implementing an embedded web server (using fcl-web), demonstrating two-way communication between Javascript and Pascal.

Various possibilities to realize your use case:
  • use pas2js for the front end
  • maybe in combination with WebAssembly
  • instead of embedded web server, your front end talks to your real server
  • your front end talks to embedded server, which then talks to real server
  • etc

HeavyUser

  • Sr. Member
  • ****
  • Posts: 397
Re: Application like Spotify or Discord
« Reply #5 on: March 29, 2022, 01:59:46 am »
I work with pascal and want to continue in that line.
The problem is that I'm kind of lost among the various possibilities for web available on lazarus... We have weblaz, CEF4Delphi, Pas2JS, fastplaz...
I follow the forums where people defend the advantages of use fastCGI ...  :) ...
At the end of the day, there's a lot of information and a lot of opinion and we don't have a place to start... and without a clear idea of how to structure all this knowledge and effectively be able to use it objectively...
Sorry... this has nothing to do with the case...
I'm just explaining this with the intention that someone more experienced can point me in the right direction..or at least in the best possible direction...
Thank you very much!

CGI/FastCGI a protocol used from a web server to execute external application and return data from them as html pages.

PHP/Python etc they provide a cgi/fastcgi application that it is used a gateway to execute scripts and return data as html pages.

Pas2js a transpiler from pascal to java script the end result run directly on the clients machine this requires good knowledge of the javascript world and a lot of patience.

CEF4Delphi not a web framework just an embedded browser engine you can use to create your own browser or your own javascript host environment not a web framework

FastPLaz, webLaz sound like an implementation of the cgi/fastcgi protocol for lazarus a good start but not a web framework by any stretch of the imagination. I have no idea though I never used them.

In sort for web development pascal is your enemy not your friend.

PierceNg

  • Sr. Member
  • ****
  • Posts: 373
    • SamadhiWeb
Re: Application like Spotify or Discord
« Reply #6 on: March 29, 2022, 02:26:16 am »
In sort for web development pascal is your enemy not your friend.

Enemy is too strong a word. Most of the necessary pieces are there, of sufficient maturity to deliver working solutions. A framework that hangs the pieces together coherently would be nice (and maybe mORMot is one) but frameworks bring their own trade-offs.

Certainly there is no hype around Pascal for web dev at all but that's just the general state of the Pascal ecosystem.

trev

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 2020
  • Former Delphi 1-7, 10.2 user
Re: Application like Spotify or Discord
« Reply #7 on: March 29, 2022, 04:47:59 am »
At the end of the day, there's a lot of information and a lot of opinion and we don't have a place to start... and without a clear idea of how to structure all this knowledge and effectively be able to use it objectively...

In my opinion (yep, on Forums you are always going to get someone's opinion when you ask a question) the bets place to start would be the Wiki's Web Develoment Portal. The Wiki's HowTo Demos Portal may also be a goof place to check.

VisualLab

  • Sr. Member
  • ****
  • Posts: 321
Re: Application like Spotify or Discord
« Reply #8 on: March 29, 2022, 09:38:55 am »
Maybe you need to start by analyzing what the end-user really needs. Without making any starting assumptions about specific solutions: technology, libraries, protocols. To start with, just what information the user wants to get. Seems the server side (app) will be needed anyway. But to think seriously is what the client side (app) needs. Technologies, libraries, protocols should rather result from the needs (be selected according to specific needs). So that it doesn't turn out like this at the end:

https://public-media.interaction-design.org/images/uploads/c4ba566193a6978b2e15bb4457d61a91.jpg

What is the reason for the ardent belief that the application should / must run in a web browser? And that such a solution is best for the end user? Of course, each application designer chooses what he wants. The only question is whether the browser application has so many advantages (both for the user and for the programmer), or is it rather a technological fashion?

Warfley

  • Hero Member
  • *****
  • Posts: 1499
Re: Application like Spotify or Discord
« Reply #9 on: March 29, 2022, 10:48:54 am »
Thank you so much for the information... This already helps to start clearing the way!

I intend to build an operations management system to control projects and activities in the operations sector of a company.

Currently, we are even using Grafana to present dashboards, plot graphs and present indicators. But I just want to implement my system based on this idea.

For that I get the data in a database of an old system that we have running here... (made in delphi7)... but I need to evolve from this old technology... to effectively create a new application.

That is, the face of the system will be based on dashboards presenting synthetic data, graphs and indicators of production and project status, activities in progress and the results of the operations sector.

I will implement interfaces for engineers and technicians to register, update and monitor projects in progress, appointments, schedules and tasks in progress... In the end we will have a mix of "project manager and productivity control".. .only functional and specific to our case.

I intend to store the data (the CRUD of this system (I'm thinking this would be the server side)) using Firebird or Postgres. And I want to apply what I've been learning, evolving and practicing for a few years in terms of Clean Architecture, SOLID, DDD, TDD development best practices.

If you want to use web technology for this visualization I would do the following: create a backend-frontend solution, where the backend is a server that handles the data, loads the data from the SQL, and prepares the data for visualization. The frontend is then a very simple website, which then fetches the Data from the server and displays it nicely.
The backend server could then be a simple REST API which you can create using fpWeb, where you provide HTTP endpoints like /ProjectStatus or something similar which your frontend can call to receive the Data.
By making your frontend a simple website with no fancy additional technology or frameworks like CEF, Webview, React or similars you have the advantage that you can simply run and debug it with nothing more than a web browser, meaning you just compile your pas2js, start it in your firefox or chrome and get going, no setup, no libraries, nothing required.
If you later want to ship this as an app, you can still pack it into such, but during development it is probably the easiest to simply start up a browser locally and get going.

avra

  • Hero Member
  • *****
  • Posts: 2514
    • Additional info
Re: Application like Spotify or Discord
« Reply #10 on: March 29, 2022, 12:43:59 pm »
Currently, we are even using Grafana to present dashboards, plot graphs and present indicators. But I just want to implement my system based on this idea.
Is there a specific reason why you do not want to keep Grafana?

I intend to store the data (the CRUD of this system (I'm thinking this would be the server side)) using Firebird or Postgres.
In case you have lots of time series data (especially if data relevancy expires after a while), InfluxDB might be a better choice (for time series part).

These might be of interest to you:
https://github.com/jbsolucoes/ceosmw
https://github.com/r3code/pascal-jsonrpc-lite-2
https://wiki.lazarus.freepascal.org/SQLDBRestBridge
https://wiki.freepascal.org/mORMot
ct2laz - Conversion between Lazarus and CodeTyphon
bithelpers - Bit manipulation for standard types
pasettimino - Siemens S7 PLC lib

nicanor

  • New Member
  • *
  • Posts: 17
Re: Application like Spotify or Discord
« Reply #11 on: March 29, 2022, 11:26:44 pm »
Is there a specific reason why you do not want to keep Grafana?

No... The point is that I really need to create a new application to manage my department's work, projects, services and productivity, so I want to take advantage of the possibility of using the numbers, indicators and graphs that I would need to do, for for example, for a presentation of results, as a kind of cover or face of the system... and this ends up eliminating the need for grafana for this specific case.
But I will continue to use it for other purposes, Grafana is very useful for me, especially if I need to show how a consultancy for a client will proceed... I can show a preview of what will be done, the evolution of the work and the results that will be achieved using Grafana resources...
The way I'm applying it internally is that it's underused.
Thanks for the tip about InfluxDB!

If you want to use web technology for this visualization I would do the following: create a backend-frontend solution, where the backend is a server that handles the data, loads the data from the SQL, and prepares the data for visualization. The frontend is then a very simple website, which then fetches the Data from the server and displays it nicely.
The backend server could then be a simple REST API which you can create using fpWeb, where you provide HTTP endpoints like /ProjectStatus or something similar which your frontend can call to receive the Data.
By making your frontend a simple website with no fancy additional technology or frameworks like CEF, Webview, React or similars you have the advantage that you can simply run and debug it with nothing more than a web browser, meaning you just compile your pas2js, start it in your firefox or chrome and get going, no setup, no libraries, nothing required.
If you later want to ship this as an app, you can still pack it into such, but during development it is probably the easiest to simply start up a browser locally and get going.

It definitely seems to put, in writing, what I was concluding and tending to do, but couldn't find a way to express. Of course, the job of structuring consistently this way I couldn't do  :D !

I appreciated it so much!

Maybe you need to start by analyzing what the end-user really needs. Without making any starting assumptions about specific solutions: technology, libraries, protocols. To start with, just what information the user wants to get. Seems the server side (app) will be needed anyway. But to think seriously is what the client side (app) needs. Technologies, libraries, protocols should rather result from the needs (be selected according to specific needs). So that it doesn't turn out like this at the end:

https://public-media.interaction-design.org/images/uploads/c4ba566193a6978b2e15bb4457d61a91.jpg

What is the reason for the ardent belief that the application should / must run in a web browser? And that such a solution is best for the end user? Of course, each application designer chooses what he wants. The only question is whether the browser application has so many advantages (both for the user and for the programmer), or is it rather a technological fashion?

Man...! I think this is at the heart of most of my problems and probably the cause of my 6 months (or more) of procrastination in starting this project right away and stop figuring out... The point is that I stopped being in doubt and decided to take a stand.... But, you realize, that I still don't want to surrender completely  :)... I'm trying here "to control" the "main form" of my application and design a system that works independently of browsers... But the fact is that I still don't know what do not stop my department if the internet is not stable around here...

In my opinion (yep, on Forums you are always going to get someone's opinion when you ask a question) the bets place to start would be the Wiki's Web Develoment Portal. The Wiki's HowTo Demos Portal may also be a goof place to check.


Precious!!  Thank you!

In sort for web development pascal is your enemy not your friend.

So it is...! This is also another reason for doubts in my dilemma... There are many people who argue along these lines and many people who argue that the so-called "modern languages ​​or tools" for web development are nothing more than a large set of layers and layers over the same fundamental structure and, if we make good use of what we already have in traditional languages, it would be possible to avoid the extra computational effort of these layers and create slimmer solutions with better performance... anyway... I think it's a level of discernment that I still can't reach, but I need to do

Take a look at fpwebview - an FPC binding for Webview, which is a tiny cross-platform library for building modern cross-platform GUIs using web technology. Webview uses GTK WebKit, Cocoa WebKit and MS WebView2 on Linux, macOS and Windows respectively.

There is an example implementing an embedded web server (using fcl-web), demonstrating two-way communication between Javascript and Pascal.

Various possibilities to realize your use case:
  • use pas2js for the front end
  • maybe in combination with WebAssembly
  • instead of embedded web server, your front end talks to your real server
  • your front end talks to embedded server, which then talks to real server
  • etc


Cool! Thank you!

nicanor

  • New Member
  • *
  • Posts: 17
Re: Application like Spotify or Discord
« Reply #12 on: March 31, 2022, 01:58:45 am »
About Fano and Brook frameworks, what is your perception about their use?
(I have my reservations about using tools that may eventually be discontinued (they are not an "official" part of Lazarus or FPC). I have had problems with this in the past when using components for Delphi that have been discontinued).
But what do you think about their application and use and how they fit into the context of web development with Lazarus?

PierceNg

  • Sr. Member
  • ****
  • Posts: 373
    • SamadhiWeb
Re: Application like Spotify or Discord
« Reply #13 on: March 31, 2022, 05:19:54 am »
About Fano and Brook frameworks, what is your perception about their use?
(I have my reservations about using tools that may eventually be discontinued (they are not an "official" part of Lazarus or FPC). I have had problems with this in the past when using components for Delphi that have been discontinued).
But what do you think about their application and use and how they fit into the context of web development with Lazarus?

In my experience large (non-Pascal) web frameworks contain many/most of the below. Also in my experience, with a well integrated and coherent framework, app/API development becomes boring and feels like work. :P Depending on your objectives, this may or may not be what you want. :D

- basics: accepting requests, providing responses, routing
- managing JSON in/out for RESTful APIs
- templating for server-rendered web apps
- JWT, OAuth2, OpenID Connect for authenticating to RESTful APIs
- session authentication for browser-driven server-rendered web apps
- modern password hashing to allow easy building of user management functionality
- ORM (or their functional equivalent) that makes it easy to do CRUD operations
- direct SQL access for complex queries feeding results into JSON and templates
- supports leading SQL and NoSQL databases
- works with Redis, memcached and similar out of the box
- works with messaging/queueing systems
- integration with cloud SDKs
- websockets
- WebAssembly
- and stuff I've missed

Most of these pieces are in FCL or exist as 3rd party libraries, but you the programmer has to integrate them in your app. I've not used mORMot, but it seems to tick most of the boxes according to its docu. I've only played briefly with Brooke and Fano, and I think they are missing most of the above.

nicanor

  • New Member
  • *
  • Posts: 17
Re: Application like Spotify or Discord
« Reply #14 on: March 31, 2022, 03:12:46 pm »
Great!  :D

In my studies on web development with Lazarus/FPC I have noticed that there has been a lot of evolution in the technology and in the implemented solutions. If we only consider fp-web and look at its history, we can see this evolution.
We can trace a timeline starting from the beginning, maybe, where we could count on CGI (maybe even telnet)... the initial versions of Indy, going through the first (simpler) frameworks that used and encapsulated the first technologies... the evolution of these frameworks etc... I don't know if it would be too much extrapolating if we consider the influences coming from more recent technologies used in other tools (latest javascript, node for example)... anyway.
Certainly, analyzing this history (taking into account the documentation we have at https://wiki.lazarus.freepascal.org/Portal:Web_Development and its links) we can perhaps draw a parallel between the various web solutions that were created (for Lazarus/FPC) over time and, knowing their intersections and possible overlaps, as well as the evolution of development technology and the web environment itself where programs run today...
In this context, and in general terms, is it possible (if we can say so) to make a relation where we can know which solution replaced which one? ... Which ones could we say have fallen into obsolescence, because some more recent solution (or that followed technological evolution more effectively) absorbed it?
If that is possible, at least considering that we are starting a new project today, and that this is a relatively large and important project, what analysis can be done?

 

TinyPortal © 2005-2018