FUXA icon indicating copy to clipboard operation
FUXA copied to clipboard

its possibile separate client and server side?

Open mircotamburini opened this issue 3 years ago • 7 comments

its possibile separate client and server side.... i would like to do an .Net Server side

mircotamburini avatar Mar 04 '22 13:03 mircotamburini

Hi, of course and interesting idea (#43), in the simple diagram you see the communication with the server goes through webapi and socket.io.

FUXA_server-interface

unocelli avatar Mar 05 '22 21:03 unocelli

Thank you, there's documentation that describe api call method? It can be very usefully

mircotamburini avatar Mar 06 '22 07:03 mircotamburini

I start to write a Asp.Net WebApi controller , i need RequestModel / ResponseModel of every web call...

using Microsoft.AspNetCore.Mvc;

namespace Fuxa.Server { [ApiController] [Route("/api")] public class ApiController : ControllerBase {

    private readonly ILogger<ApiController> logger;
    

    public ApiController(ILogger<ApiController> logger)
    {
        this.logger = logger;

    }

    [HttpGet("settings")]
    public async Task GetSettings(string req)
    {
       logger.LogInformation(req);
    }

    [HttpPost("settings")]
    public async Task PostSettings(string req)
    {
        logger.LogInformation(req);
    }


    /**
    * GET current Alarms 
    * Take from alarms storage and reply 
    */
    [HttpGet("alarms")]
    public async Task GetAlarms(string req)
    {
        logger.LogInformation(req);
    }

    /**
    * GET current Alarms 
    * Take from alarms storage and reply 
    */
    [HttpGet("alarmsHistory")]
    public async Task GetAlarmsHistory(string req)
    {
        logger.LogInformation(req);
    }

    /**
     * POST Alarm ACK
     * Set alarm ack
     */
    [HttpPost("alarmack")]
    public async Task PostAlarmAck(string req)
    {
        logger.LogInformation(req);
    }

    /**
     * POST Alarms clear
     */
    [HttpPost("alarmsClear")]
    public async Task PostAlarmClear(string req)
    {
        logger.LogInformation(req);
    }

    /**
     * POST SignIn
     * Sign In with User credential
     */
    [HttpPost("signin")]
    public async Task PostSignin(string req)
    {
        logger.LogInformation(req);
    }

    /**
     * GET daq data
     * Take from daq storage data and reply 
     */
    [HttpPost("daq")]
    public async Task PostDaq(string req)
    {
        logger.LogInformation(req);
    }


    /**
     * GET Server logs folder content
     */
    [HttpGet("logsdir")]
    public async Task GetLogsDir(string req)
    {
        logger.LogInformation(req);
    }


    /**
     * GET supported Plugin and status (installed) 
     */
    [HttpGet("plugins")]
    public async Task GetPlugins(string req)
    {
        logger.LogInformation(req);
    }

    /**
    * POST Plugin
    * Install the plugin
    */
    [HttpPost("plugins")]
    public async Task PostPlugins(string req)
    {
        logger.LogInformation(req);
    }

    /**
    * DELETE Plugin
    * Unistall the plugin
    */
    [HttpDelete("plugins")]
    public async Task DeletePlugins(string req)
    {
        logger.LogInformation(req);
    }

    /**
     * GET Project data
     * Take from project storage and reply 
     */
    [HttpGet("project")]
    public async Task GetProject(string req)
    {
        logger.LogInformation(req);
    }

    /**
    * POST Project data
    * Set to project storage
    */
    [HttpPost("project")]
    public async Task PostProject(string req)
    {
        logger.LogInformation(req);
    }

    /**
    * POST Single Project data
    * Set the value (general/view/device/...) to project storage
    */
    [HttpPost("projectData")]
    public async Task PostProjectData(string req)
    {
        logger.LogInformation(req);
    }

    /**
    * GET Project demo data
    * Take the project demo file from server folder 
    */
    [HttpGet("projectdemo")]
    public async Task GetProjectDemo(string req)
    {
        logger.LogInformation(req);
    }


    /**
    * GET Device property like security
    * Take from project storage and reply 
    */
    [HttpGet("device")]
    public async Task GetDevice(string req)
    {
        logger.LogInformation(req);
    }


    /**
    * POST Device property
    * Set to project storage
    */
    [HttpPost("device")]
    public async Task PostDevice(string req)
    {
        logger.LogInformation(req);
    }

    /**
    * POST Upload file resource
    * images will be in media file saved
    */
    [HttpPost("upload")]
    public async Task PostUpload(string req)
    {
        logger.LogInformation(req);
    }

    /**
     * POST runscript
     * Run script, can be call with script id or script content as test 
     */
    [HttpPost("runscript")]
    public async Task PostRunScript(string req)
    {
        logger.LogInformation(req);
    }

    /**
     * GET Users
     * Take from users storage and reply 
     */
    [HttpGet("users")]
    public async Task GetUsers(string req)
    {
        logger.LogInformation(req);
    }

    /**
     * POST Users
     * Set to users storage
     */
    [HttpPost("users")]
    public async Task PostUsers(string req)
    {
        logger.LogInformation(req);
    }

    /**
     * DELETE User
     * Set to project storage
     */
    [HttpDelete("users")]
    public async Task DeleteUsers(string req)
    {
        logger.LogInformation(req);
    }
}

}

mircotamburini avatar Mar 06 '22 13:03 mircotamburini

I hope it can help you. please let me know if you find any errors ;) FUXA_WebAPI.pdf

unocelli avatar Mar 06 '22 13:03 unocelli

yeah it's exactly what i need :)

mircotamburini avatar Mar 06 '22 13:03 mircotamburini

which port use socket.io fuxa client

mircotamburini avatar Mar 30 '22 10:03 mircotamburini

I don't set a port: const io = socketIO(server); so it should be the same as the web server (1881).

unocelli avatar Mar 30 '22 19:03 unocelli

I start to write a Asp.Net WebApi controller , i need RequestModel / ResponseModel of every web call...

using Microsoft.AspNetCore.Mvc;

namespace Fuxa.Server { [ApiController] [Route("/api")] public class ApiController : ControllerBase {

    private readonly ILogger<ApiController> logger;
    

    public ApiController(ILogger<ApiController> logger)
    {
        this.logger = logger;

    }

    [HttpGet("settings")]
    public async Task GetSettings(string req)
    {
       logger.LogInformation(req);
    }

    [HttpPost("settings")]
    public async Task PostSettings(string req)
    {
        logger.LogInformation(req);
    }


    /**
    * GET current Alarms 
    * Take from alarms storage and reply 
    */
    [HttpGet("alarms")]
    public async Task GetAlarms(string req)
    {
        logger.LogInformation(req);
    }

    /**
    * GET current Alarms 
    * Take from alarms storage and reply 
    */
    [HttpGet("alarmsHistory")]
    public async Task GetAlarmsHistory(string req)
    {
        logger.LogInformation(req);
    }

    /**
     * POST Alarm ACK
     * Set alarm ack
     */
    [HttpPost("alarmack")]
    public async Task PostAlarmAck(string req)
    {
        logger.LogInformation(req);
    }

    /**
     * POST Alarms clear
     */
    [HttpPost("alarmsClear")]
    public async Task PostAlarmClear(string req)
    {
        logger.LogInformation(req);
    }

    /**
     * POST SignIn
     * Sign In with User credential
     */
    [HttpPost("signin")]
    public async Task PostSignin(string req)
    {
        logger.LogInformation(req);
    }

    /**
     * GET daq data
     * Take from daq storage data and reply 
     */
    [HttpPost("daq")]
    public async Task PostDaq(string req)
    {
        logger.LogInformation(req);
    }


    /**
     * GET Server logs folder content
     */
    [HttpGet("logsdir")]
    public async Task GetLogsDir(string req)
    {
        logger.LogInformation(req);
    }


    /**
     * GET supported Plugin and status (installed) 
     */
    [HttpGet("plugins")]
    public async Task GetPlugins(string req)
    {
        logger.LogInformation(req);
    }

    /**
    * POST Plugin
    * Install the plugin
    */
    [HttpPost("plugins")]
    public async Task PostPlugins(string req)
    {
        logger.LogInformation(req);
    }

    /**
    * DELETE Plugin
    * Unistall the plugin
    */
    [HttpDelete("plugins")]
    public async Task DeletePlugins(string req)
    {
        logger.LogInformation(req);
    }

    /**
     * GET Project data
     * Take from project storage and reply 
     */
    [HttpGet("project")]
    public async Task GetProject(string req)
    {
        logger.LogInformation(req);
    }

    /**
    * POST Project data
    * Set to project storage
    */
    [HttpPost("project")]
    public async Task PostProject(string req)
    {
        logger.LogInformation(req);
    }

    /**
    * POST Single Project data
    * Set the value (general/view/device/...) to project storage
    */
    [HttpPost("projectData")]
    public async Task PostProjectData(string req)
    {
        logger.LogInformation(req);
    }

    /**
    * GET Project demo data
    * Take the project demo file from server folder 
    */
    [HttpGet("projectdemo")]
    public async Task GetProjectDemo(string req)
    {
        logger.LogInformation(req);
    }


    /**
    * GET Device property like security
    * Take from project storage and reply 
    */
    [HttpGet("device")]
    public async Task GetDevice(string req)
    {
        logger.LogInformation(req);
    }


    /**
    * POST Device property
    * Set to project storage
    */
    [HttpPost("device")]
    public async Task PostDevice(string req)
    {
        logger.LogInformation(req);
    }

    /**
    * POST Upload file resource
    * images will be in media file saved
    */
    [HttpPost("upload")]
    public async Task PostUpload(string req)
    {
        logger.LogInformation(req);
    }

    /**
     * POST runscript
     * Run script, can be call with script id or script content as test 
     */
    [HttpPost("runscript")]
    public async Task PostRunScript(string req)
    {
        logger.LogInformation(req);
    }

    /**
     * GET Users
     * Take from users storage and reply 
     */
    [HttpGet("users")]
    public async Task GetUsers(string req)
    {
        logger.LogInformation(req);
    }

    /**
     * POST Users
     * Set to users storage
     */
    [HttpPost("users")]
    public async Task PostUsers(string req)
    {
        logger.LogInformation(req);
    }

    /**
     * DELETE User
     * Set to project storage
     */
    [HttpDelete("users")]
    public async Task DeleteUsers(string req)
    {
        logger.LogInformation(req);
    }
}

}

Where is the .NET Core version? Can I participate in it?

luy710 avatar Nov 27 '23 05:11 luy710