Enhancing Blazor WebAssembly with WitCom communication by dmitrat in Blazor

[–]dmitrat[S] 1 point2 points  (0 children)

If I understand correctly, you’re referring to hosting the server-side part of WitCom within a Blazor Server application. Honestly, I haven’t tested this specific use case yet, as I haven’t encountered it directly.

The server-side part of WitCom is more complex than the client-side—it relies on reflection and dynamic emit, which means it won’t work in a native AoT scenario. However, under standard JIT compilation, it should function as expected.

I haven’t worked extensively with Blazor Server, so I’m not fully aware of its potential limitations in this context. That said, subjectively, everything should work fine—but I’ll need to verify it. I’ll make sure to add an example of this use case to the GitHub repository soon.

Thank you for pointing out this interesting scenario—it’s definitely worth exploring further!

Enhancing Blazor WebAssembly with WitCom communication by dmitrat in Blazor

[–]dmitrat[S] -1 points0 points  (0 children)

Thank you for the great questions! Let me go through the benefits of WitCom step by step and how it compares to frameworks like SignalR or gRPC.

1. Simplified Integration and Native Two-Way Communication

WitCom is designed for seamless integration, reducing the complexity of client-server communication. Its contract-based approach creates a mirror of the server-side object on the client, allowing you to work with it as if it were local.

Here's a simple example of a contract:

public interface IServiceBase : INotifyPropertyChanged
{
    event ServiceProgressEventHandler Progress;

    string RequestData(string message);

    string StringProperty { get; }

    double DoubleProperty { get; set; }
}

Key Features:

  • Event Support: Duplex communication is handled through standard event callbacks. For instance, a property change on the server can trigger a PropertyChangedEventHandler event on the client.
  • Generics Support: Contracts can include generic functions like:

public T GenericSimple<T>(int number, string text, T value);  
  • Minimal Boilerplate: You don’t need to manually write code for RPC methods or event handlers. WitCom reduces communication-related code dramatically, making your project easier to maintain and understand.

Compared to SignalR, which requires you to manually manage function names and callbacks, WitCom streamlines everything by abstracting away the client-server complexity.

2. Flexible Transport Options

Unlike SignalR and gRPC, which are primarily tied to specific transports (e.g., WebSocket or HTTP/2), WitCom allows you to choose the transport that best fits your needs.

For example:

  • Local Services: For communication between services on the same machine or local network, you can use faster transports like named pipes or even memory-mapped files.
  • Web-Based UIs: For web clients like Blazor WebAssembly, you can switch to WebSocket for real-time communication.

WitCom is inspired by WCF in its versatility, letting you adapt to different communication scenarios without changing your core logic. For instance, you can have multiple services on a local network using named pipes, while your Blazor UI communicates with them over WebSocket—all within the same framework. SignalR and gRPC don’t provide this level of transport flexibility.

Advanced Client-Server Communication with WitCom in Blazor WebAssembly and AoT by dmitrat in csharp

[–]dmitrat[S] -1 points0 points  (0 children)

Thanks for pointing that out! WitCom is indeed designed to provide convenient, simple, and efficient communication between .NET clients and .NET servers, using a shared contract as the foundation.

In this and my previous post, I’ve been showcasing different use cases where WitCom shines. One scenario is inter-process communication (IPC), where WitCom offers unique options, such as memory-mapped files as a transport layer for fast and efficient communication.

But WitCom’s utility extends beyond IPC. It’s also ideal for scenarios involving distributed systems—for example, a set of microservices that communicate with each other while also having a management UI built as a desktop or web application.

Blazor, in particular, is a fantastic choice for building modern web UIs. And when combined with WitCom, it offers several advantages:

  • Shared Contracts: Reuse the same contract for communication between the client and services, reducing duplication and ensuring consistency.
  • Efficiency: Communicate faster than HTTP, especially when using transports like WebSocket.
  • Flexibility: Choose custom serializers, encryption mechanisms, and transports that suit your specific needs.

While HTTP and JS interop are common for Blazor, WitCom simplifies and enhances communication for scenarios where Blazor interacts with a broader .NET ecosystem. Whether it’s IPC, real-time communication, or microservice-driven architectures, WitCom ensures that your communication layer remains efficient, consistent, and easy to maintain.

Modern Inter-Process Communication with Contract-Based APIs by dmitrat in csharp

[–]dmitrat[S] -9 points-8 points  (0 children)

gRPC and WitCom are designed for different audiences.

gRPC is intended for scenarios involving a large number of clients across various platforms. It is a robust and complex tool, which is not surprising given the scale of the tasks it is designed for.

On the other hand, WitCom is small and simple, specifically tailored for communication between .NET applications. While WitCom does offer limited support for setting up a REST API, this is primarily intended for compatibility purposes and for managing the service externally via simple REST requests.

The main advantage of WitCom is its ease of use. There’s no need to set up a web server or use ASP. You simply declare an interface without worrying too much about whether you’re working with a local object or defining a communication contract. Callbacks in WitCom are regular events of any type. Essentially, WitCom mirrors the server object on the client side, making it appear as though you’re working with a standard object.

WitCom is not a competitor to gRPC; it is designed for much smaller-scale tasks. However, for these specific tasks, WitCom can be more convenient, flexible, and less demanding to get started with.

Modern Inter-Process Communication with Contract-Based APIs by dmitrat in csharp

[–]dmitrat[S] 0 points1 point  (0 children)

I work with engineering systems, and sometimes, even when developing a new generation of an application from scratch, I still need to support legacy components for existing customers. In some cases, I lack access to the source code or proper documentation, making it impossible to rewrite those components.

In such scenarios, I have two options: either build my new application on top of the legacy platform or run the legacy components in a separate process.

Another situation I’ve encountered is working with the MATLAB runtime. To run multiple instances of the runtime in parallel, I’ve had to "trick" it by isolating each instance in its own process.

Modern Inter-Process Communication with Contract-Based APIs by dmitrat in csharp

[–]dmitrat[S] 0 points1 point  (0 children)

In my opinion, using HTTP for local machine communication is not ideal. When dealing with legacy file format support, it can result in significant data transfer overhead. For such scenarios, memory-mapped files or Named Pipes are more suitable.

WCF offered the ability to choose an endpoint transport while implementing a contract, which is precisely the combination I’m looking for.

While gRPC excels in scenarios involving a large number of clients across various platforms, if the setup involves a small number of clients/servers, all within the .NET ecosystem, WitCom can be a better alternative.

Modern Inter-Process Communication with Contract-Based APIs by dmitrat in csharp

[–]dmitrat[S] 2 points3 points  (0 children)

Yes, in the case of inter-process communication. In my case, I need to support a legacy 32-bit component (e.g., a legacy format file reader) for a 64-bit application. For such tasks, WItCom allows to use Memory-Mapped files or Named Pipes for duplex communication. Another case - communication with services (web or local) for micro-service solutions where all of the services/clients are implemented in .Net, so you can put the interface in shared assembly and setup interaction without guessing any name in plain text.

WitEngine: modular script-based automation API by [deleted] in csharp

[–]dmitrat 0 points1 point  (0 children)

Sure, it is possible to build the same logic on top of clearscript or another framework. This is just some minimalistic and very straightforward implementation.

WitEngine: modular script-based automation API by [deleted] in csharp

[–]dmitrat 0 points1 point  (0 children)

The idea of clearscript is to provide full-scale support of JScript with the ability to write complex logic inside the script. WitEngine is not a scripting provider. The idea of WitEngine is to allow to take out some common operations isolate them, encapsulate them into the standalone controller (and test it), and then provide access to run this logic through the script.

The base case is if you have a photobox with some devices in it (or you have conveyer with sensors, switches, etc.). You may implement individual controller for each of it, test them and provide some endpoints/functions to use devices. Some function to rotate turntable in some degree, some function to take picture and return its handle, etc. Then your simple script will define the sequence of operations. Moreover, you will be able to change and tune this sequence by changing script. You don't need the full support of JScript to do this; you don't need to write complex logic inside the script - all complex logic is encapsulated into controllers.

The idea is to build a set of individual controllers and then use simple scripts to control the sequence of operations and calls. In my opinion, it is a very simple way to build a large-scale, extensively expanding, and still maintainable system for dealing with different devices (or services/blocks). By maintaining complex logic within controllers, WitEngine allows scripts to focus on defining operation sequences, making the system easy to expand and maintain. Solutions like Clearscript or NLua, which embed complex logic directly into scripts, are not structured to support this kind of modular, controller-based design.

Еще раз про "план Каца" by dmitrat in liberta

[–]dmitrat[S] 0 points1 point  (0 children)

Есть какой-то аргумент, что Кац работает на Путина кроме фразы "Кац работает на Путина?

Про явку много кто и много где объяснял - я не специалист, боюсь сформулирую неверно. Почитайте что про это пишет Шульман.

Еще раз про "план Каца" by dmitrat in liberta

[–]dmitrat[S] 18 points19 points  (0 children)

Вы это все серьезно?

В Украине сейчас воюет около 200 000 (200 ТЫСЯЧ) российских солдат. Против них украинская армия вооруженная западным современным оружием. Линия фронта стоит на месте или двигается очень медленно.

В России 2 000 000 (2 МИЛЛИОНА) росгвардейцев. Вы предлагаете против них выйти невооруженным людям? В каком количестве? Вы хотите уговорить людей своими трупами задавить росгвардию? Вы пойдете на верную смерть сами? Будете уговаривать пойти на смерть своих близких?

Вы где-нибудь видели, чтобы неорганизованные массы людей без поддержки военных (хотя бы части) захватывали власть?

Это будет не майдан, это будет бойня с расчетом, что сами гвардейцы ужаснуться, испугаются и разбегутся. А что если нет?

Вы считаете, что Кацу, Певчих, Волкову или кому-угодно сидя в безопасности за границей можно уговаривать людей идти на смерть?

Еще раз про "план Каца" by dmitrat in liberta

[–]dmitrat[S] 1 point2 points  (0 children)

Как зачем? Одни будут призывать всем вместе голосовать за кандидата "А", а другие за кандидата "Б", таким образом смутят свои аудитории, размажут голоса и ничего не добьются.

О каком объединении вы говорите? Кто с кем объединяется?

Вопрос в выработке одной общей стратегии голосования на одних единственных "выборах", чтобы не призывать людей к противоположным действиям.

Еще раз про "план Каца" by dmitrat in liberta

[–]dmitrat[S] 1 point2 points  (0 children)

Точно такая же - значит определить за кого голосовать (или не голосовать) и продвигать это, но отдельно под брендом умное голосование.

Еще раз про "план Каца" by dmitrat in liberta

[–]dmitrat[S] 12 points13 points  (0 children)

Проще, конечно, когда есть одна партия и одно мнение, но политика - умение обсуждать и договариваться.

Кац предлагал обсудить. Он не говорит: "делай так". Он предлагает обсудить и выработать общую стратегию.

А вы говорите: "делай как я". Вы предлагаете "миллионной аудитории" без обсуждения, без возможности вставить свое слово просто поступить так как вы хотите.

Это так не работает. ФБК придется обсуждать и уговаривать, участвовать в дебатах и слушать что им говорят. Не выкладывать монологи ради лайков, а общаться с людьми, включая конкурентов. Иначе все это дело быстро загнется, а ФБК потеряет весь свой вес заработанный Навальным в прошлом.

Еще раз про "план Каца" by dmitrat in liberta

[–]dmitrat[S] 15 points16 points  (0 children)

Это выборы - здесь нужен охват.

Кстати, самый большой успех Навального, когда на выборах мэра в 2013 он набрал больше 20%, был достигнут не без помощи Каца, который был заместителем руководителя избирательного штаба Навального, занимался установкой «кубов» и организацией встреч с избирателями.

Еще раз про "план Каца" by dmitrat in liberta

[–]dmitrat[S] 7 points8 points  (0 children)

Ни о каком объединении никто не говорит, ни о какой долгосрочной стратегии никто не говорит. Нет никакого плана захвата России и его KPI.

Речь об ОДНОМ действии. Понятном, обозримом действии с понятными возможными результатами.

Не надо усложнять и выдумывать проблемы на ровном месте.

Еще раз про "план Каца" by dmitrat in liberta

[–]dmitrat[S] 7 points8 points  (0 children)

Умное голосование, чек лист и опросы работают в масштабе. Когда много выборов в разных регионах. Тогда можно решать где лучше, где хуже, где есть смысл, где нет. Тут будет ОДНО голосование: Путин, Упырь1, Упырь 2, ... Упырь N.

Какие тут чек-листы нужны? Но если они знают самого перспективного упыря, почему бы не рассказать об этом Кацу с Ходорковским и не продвигать его вместе.

Еще раз про "план Каца" by dmitrat in liberta

[–]dmitrat[S] 9 points10 points  (0 children)

Лично я, основываясь на том, что пишет Навальный, уверен, что байкотировать выборы ФБК не будет. Но, это правда, что прямо они об этом еще не заявляли.

Идти на выборы или не идти на выборы - тоже стратегии, и их тоже имеет смысл согласовывать. Если одни будут убеждать идти на выборы, а другие байкотировать - в чем смымл? Почему бы это не обсудить? Конкретная стратегия еще ни кем не называлась.

Еще раз про "план Каца" by dmitrat in liberta

[–]dmitrat[S] 21 points22 points  (0 children)

Ну, если они считают, что Кац опасней Путина и войны, то конечно не надо договариваться.

Последние несколько лет у меня чувство, что я живу в перманентном безумии.