garyprinting.com

Enhancing My Julia RPC Chat Application with New Features

Written on

Introduction to My Chat Application

I’m thrilled to share that I have completed the final touches on my JLChat application, which utilizes the Julia programming language.

Toolips Framework Updates

I’m excited to announce the release of a major update to my extensible web-development framework for Julia, known as Toolips. This latest version has replaced traditional servers with modules, resulting in a significant boost in performance. It has also integrated advanced parallel computing capabilities and has evolved further in its design philosophy, making it the ideal web-development framework I envisioned. For those interested, you can find more details on the GitHub page for the project.

The extensibility of Toolips has grown to the point where I now refer to it as a server-development framework. With just a few additional features, its application can vary significantly. Currently, I am working on two projects, ChiProxy and ChiNS, which serve as a proxy server and a UDP name server, respectively. These projects highlight the flexibility of Toolips, with ChiProxy acting as a substitute for the Toolips router, allowing for host-based routing.

While the core Toolips package stands strong on its own, the main goal of Toolips is to modify functionalities through diverse extensions. One of the key extensions is ToolipsSession, which provides full-stack callbacks, RPC, input mapping, and authentication features in its latest iteration, version 0.4. This extension is crucial for the overall Toolips ecosystem and will be essential for the documentation website I plan to develop.

With the release of Toolips, I am also looking forward to quickly launching ToolipsSession 0.4, as it is vital for creating comprehensive websites using Toolips.

Exploring the RPC Feature

As part of my ongoing development, I am creating additional packages to test and showcase the functionalities of Toolips. One feature that has undergone significant enhancement is the RPC (Remote Procedure Call) capability. Initially developed in ToolipsSession 0.3, I created a simple chat application called JLChat to demonstrate its potential. This application allowed users to join a large chatroom seamlessly.

With the improvements to the RPC feature in the new ToolipsSession, I decided to build a similar chat application to test these updates. For those seeking more context, you can refer to my previous article that provides a detailed explanation of RPC.

Before we proceed with the final steps of connecting RPC and getting our chat application operational, let’s briefly review the RPC implementation within ToolipsSession. RPC enables Toolips to execute the same calls among clients engaged in a shared RPC session.

To initiate this process, each client must use either open_rpc! or join_rpc!. These functions can be executed on a Connection or a Connection combined with a ComponentModifier. It's essential to utilize the correct function based on the required response type.

open_rpc!(c::AbstractConnection; tickrate::Int64 = 500)

open_rpc!(c::AbstractConnection, cm::ComponentModifier; tickrate::Int64 = 500)

join_rpc!(c::AbstractConnection, host::String; tickrate::Int64 = 500)

join_rpc!(c::AbstractConnection, cm::ComponentModifier, host::String; tickrate::Int64 = 500)

When using join_rpc!, you must specify the host, which is the IP address of the client you are connecting to. This information should be stored for future reference and can be retrieved using get_ip.

If a user refreshes the page, we can reconnect them using the function reconnect_rpc!(c::Connection; tickrate::Int64 = 500).

Building the Chat Interface

To enhance user experience, we need to create a dynamic menu that displays existing chats. The build_main function constructs this menu, which includes buttons for both active and inactive chats, along with an option to create new chats:

function build_main(c::AbstractConnection, cm::ComponentModifier)

chatnav = div("chatnav")

style!(chatnav, "position" => "absolute", "width" => 10percent)

active_box = div("active-chats")

style!(active_box, "width" => 100percent)

inactive_box = div("inactive-chats")

style!(inactive_box, "width" => 100percent)

create_chat = button("create-chat", text = "create chat")

on(c, create_chat, "click") do cm::ComponentModifier

append!(cm, "jlchatbod", chat_builder(c))

focus!(cm, "makerchat")

end

style!(create_chat, "color" => "white", "background-color" => "#AA336A", "width" => 100percent,

"padding" => 5px, "font-size" => 16pt, "font-weight" => "bold")

push!(chatnav, create_chat, active_box, inactive_box)

...

end

This function iterates through active chats and generates corresponding menu options. The build_chatmenu function is called to create individual chat elements, which are then added to either the active or inactive sections based on membership.

Final Thoughts

This concludes the basic outline of creating a multi-chatroom application using Julia and Toolips. While this project is relatively straightforward, it serves to showcase the new functionalities within Toolips and the significant improvements made in version 0.3. I am eager to continue enhancing this application with additional Toolips features, including advanced multi-threading capabilities and potentially developing a mobile version.

Thank you for following along on this journey!

Share the page:

Twitter Facebook Reddit LinkIn

-----------------------

Recent Post:

Enhance Your JavaScript Skills: 10 Essential Lodash Functions

Discover 10 powerful Lodash functions that can elevate your JavaScript coding efficiency and readability.

# Understanding Light Pressure and Its Role in Spacecraft Propulsion

Explore how light pressure from photons can propel spacecraft using solar sails, backed by historical theories and modern physics.

Navigating Life's Winters: A Journey to Resilience and Strength

Explore the journey through life's challenges and how to embrace personal growth and resilience during tough times.

Stay Ahead: Essential Skills for Software Engineers in 2024

Discover vital skills and strategies to remain relevant as a software engineer in 2024.

The Empowering Truth About Embracing Singlehood

Discover the empowering truths about being single, debunking stereotypes and myths, and embracing a fulfilling life without marriage.

The Quest for Balance in a Fast-Paced Society

Exploring the relentless pace of modern life and the need for balance amidst technological advances.

Finding Joy in the Little Things: A Guide to Mindfulness

Discover how appreciating life's small moments can enhance your happiness and well-being.

Insightful Analysis of 2022 Spec Script Sales Trends

An in-depth look at the 2022 spec script sales landscape across studios and streaming platforms.