<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Dipesh Dulal on Medium]]></title>
        <description><![CDATA[Stories by Dipesh Dulal on Medium]]></description>
        <link>https://medium.com/@dipesh-dulal?source=rss-84b5bac24db8------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*0WSMEJBN1EwR6DAVOgjcAQ.jpeg</url>
            <title>Stories by Dipesh Dulal on Medium</title>
            <link>https://medium.com/@dipesh-dulal?source=rss-84b5bac24db8------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Tue, 24 Nov 2026 17:42:15 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@dipesh-dulal/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Creating Subscriptions with AppSync and DynamoDB]]></title>
            <description><![CDATA[<div class="medium-feed-item"><p class="medium-feed-image"><a href="https://articles.wesionary.team/creating-subscriptions-with-appsync-and-dynamodb-2ae4c026bdd0?source=rss-84b5bac24db8------2"><img src="https://cdn-images-1.medium.com/max/1280/0*uef_lwLiHinEDdBa.png" width="1280"></a></p><p class="medium-feed-snippet">Create a graphql subscription endpoint for listening to chat messages in a room by using appsync&#x2019;s subscription feature.</p><p class="medium-feed-link"><a href="https://articles.wesionary.team/creating-subscriptions-with-appsync-and-dynamodb-2ae4c026bdd0?source=rss-84b5bac24db8------2">Continue reading on wesionaryTEAM »</a></p></div>]]></description>
            <link>https://articles.wesionary.team/creating-subscriptions-with-appsync-and-dynamodb-2ae4c026bdd0?source=rss-84b5bac24db8------2</link>
            <guid isPermaLink="false">https://medium.com/p/2ae4c026bdd0</guid>
            <category><![CDATA[chat-api]]></category>
            <category><![CDATA[dynamodb]]></category>
            <category><![CDATA[appsync]]></category>
            <category><![CDATA[graphql]]></category>
            <dc:creator><![CDATA[Dipesh Dulal]]></dc:creator>
            <pubDate>Mon, 22 May 2023 11:18:43 GMT</pubDate>
            <atom:updated>2023-05-22T11:18:43.537Z</atom:updated>
        </item>
        <item>
            <title><![CDATA[DynamoDB GraphQL API’s in AWS AppSync]]></title>
            <description><![CDATA[<div class="medium-feed-item"><p class="medium-feed-image"><a href="https://articles.wesionary.team/dynamodb-graphql-apis-in-aws-appsync-6663d0b24607?source=rss-84b5bac24db8------2"><img src="https://cdn-images-1.medium.com/max/1280/1*SvMZGo4bsGW9r7HXwvsupw.png" width="1280"></a></p><p class="medium-feed-snippet">DynamoDB is a fully managed NoSQL database service that supports key/value and document data structures offered by AWS. Whereas, AWS&#x2026;</p><p class="medium-feed-link"><a href="https://articles.wesionary.team/dynamodb-graphql-apis-in-aws-appsync-6663d0b24607?source=rss-84b5bac24db8------2">Continue reading on wesionaryTEAM »</a></p></div>]]></description>
            <link>https://articles.wesionary.team/dynamodb-graphql-apis-in-aws-appsync-6663d0b24607?source=rss-84b5bac24db8------2</link>
            <guid isPermaLink="false">https://medium.com/p/6663d0b24607</guid>
            <category><![CDATA[dynamodb]]></category>
            <category><![CDATA[aws]]></category>
            <category><![CDATA[graphql]]></category>
            <category><![CDATA[appsync]]></category>
            <dc:creator><![CDATA[Dipesh Dulal]]></dc:creator>
            <pubDate>Mon, 20 Feb 2023 09:53:40 GMT</pubDate>
            <atom:updated>2023-05-23T03:35:08.209Z</atom:updated>
        </item>
        <item>
            <title><![CDATA[Logging Interfaces in Go]]></title>
            <description><![CDATA[<div class="medium-feed-item"><p class="medium-feed-image"><a href="https://articles.wesionary.team/logging-interfaces-in-go-182c28be3d18?source=rss-84b5bac24db8------2"><img src="https://cdn-images-1.medium.com/max/1280/1*2bMYB-XkXwo2xNEkmXQEXA.png" width="1280"></a></p><p class="medium-feed-snippet">There are different logging interfaces in go-lang. Each and every library comes up with its version of logging interfaces. While we are&#x2026;</p><p class="medium-feed-link"><a href="https://articles.wesionary.team/logging-interfaces-in-go-182c28be3d18?source=rss-84b5bac24db8------2">Continue reading on wesionaryTEAM »</a></p></div>]]></description>
            <link>https://articles.wesionary.team/logging-interfaces-in-go-182c28be3d18?source=rss-84b5bac24db8------2</link>
            <guid isPermaLink="false">https://medium.com/p/182c28be3d18</guid>
            <category><![CDATA[software-engineering]]></category>
            <category><![CDATA[gin]]></category>
            <category><![CDATA[fx]]></category>
            <category><![CDATA[gorm]]></category>
            <category><![CDATA[go]]></category>
            <dc:creator><![CDATA[Dipesh Dulal]]></dc:creator>
            <pubDate>Tue, 03 May 2022 05:28:40 GMT</pubDate>
            <atom:updated>2022-05-03T05:28:40.426Z</atom:updated>
        </item>
        <item>
            <title><![CDATA[WebRTC Live Streaming with AntMedia in React Native]]></title>
            <description><![CDATA[<div class="medium-feed-item"><p class="medium-feed-image"><a href="https://articles.wesionary.team/webrtc-live-streaming-with-antmedia-in-react-native-7582ffb37e3c?source=rss-84b5bac24db8------2"><img src="https://cdn-images-1.medium.com/max/1200/1*GOM6Hh2ndnGlLFKQXsl9wA.png" width="1200"></a></p><p class="medium-feed-snippet">Live Streaming has come a long way from having minutes of latency to ultra low latency. Live stream has always been hard to do because of&#x2026;</p><p class="medium-feed-link"><a href="https://articles.wesionary.team/webrtc-live-streaming-with-antmedia-in-react-native-7582ffb37e3c?source=rss-84b5bac24db8------2">Continue reading on wesionaryTEAM »</a></p></div>]]></description>
            <link>https://articles.wesionary.team/webrtc-live-streaming-with-antmedia-in-react-native-7582ffb37e3c?source=rss-84b5bac24db8------2</link>
            <guid isPermaLink="false">https://medium.com/p/7582ffb37e3c</guid>
            <category><![CDATA[react-native]]></category>
            <category><![CDATA[ant-media-server]]></category>
            <category><![CDATA[webrtc]]></category>
            <category><![CDATA[live-streaming]]></category>
            <category><![CDATA[software-development]]></category>
            <dc:creator><![CDATA[Dipesh Dulal]]></dc:creator>
            <pubDate>Thu, 29 Apr 2021 11:19:24 GMT</pubDate>
            <atom:updated>2021-04-29T11:19:24.740Z</atom:updated>
        </item>
        <item>
            <title><![CDATA[Building Basic Event Scheduler in Go]]></title>
            <description><![CDATA[<div class="medium-feed-item"><p class="medium-feed-image"><a href="https://articles.wesionary.team/building-basic-event-scheduler-in-go-134c19f77f84?source=rss-84b5bac24db8------2"><img src="https://cdn-images-1.medium.com/max/2600/1*gBs7tyig8N5eeHNMOwIG8w.png" width="4500"></a></p><p class="medium-feed-snippet">When we need to run a task after certain period of time, at a given time, on intervals etc, we need to use task scheduling system that is&#x2026;</p><p class="medium-feed-link"><a href="https://articles.wesionary.team/building-basic-event-scheduler-in-go-134c19f77f84?source=rss-84b5bac24db8------2">Continue reading on wesionaryTEAM »</a></p></div>]]></description>
            <link>https://articles.wesionary.team/building-basic-event-scheduler-in-go-134c19f77f84?source=rss-84b5bac24db8------2</link>
            <guid isPermaLink="false">https://medium.com/p/134c19f77f84</guid>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[scheduling]]></category>
            <category><![CDATA[software-engineering]]></category>
            <category><![CDATA[go]]></category>
            <category><![CDATA[coding]]></category>
            <dc:creator><![CDATA[Dipesh Dulal]]></dc:creator>
            <pubDate>Sat, 16 Jan 2021 08:59:38 GMT</pubDate>
            <atom:updated>2021-01-16T08:59:38.402Z</atom:updated>
        </item>
        <item>
            <title><![CDATA[Docker Debug Environment for Go and Gin Framework]]></title>
            <description><![CDATA[<div class="medium-feed-item"><p class="medium-feed-image"><a href="https://articles.wesionary.team/docker-debug-environment-for-go-and-gin-framework-36df80e061ac?source=rss-84b5bac24db8------2"><img src="https://cdn-images-1.medium.com/max/1280/1*EaRthppynT9ZpRF0pFd1qg.png" width="1280"></a></p><p class="medium-feed-snippet">Setting up development environment with live reloading and remote debugging setup for go-lang alongside attaching debugger in vs code.</p><p class="medium-feed-link"><a href="https://articles.wesionary.team/docker-debug-environment-for-go-and-gin-framework-36df80e061ac?source=rss-84b5bac24db8------2">Continue reading on wesionaryTEAM »</a></p></div>]]></description>
            <link>https://articles.wesionary.team/docker-debug-environment-for-go-and-gin-framework-36df80e061ac?source=rss-84b5bac24db8------2</link>
            <guid isPermaLink="false">https://medium.com/p/36df80e061ac</guid>
            <category><![CDATA[debugging]]></category>
            <category><![CDATA[go]]></category>
            <category><![CDATA[software-engineering]]></category>
            <category><![CDATA[docker]]></category>
            <category><![CDATA[programming]]></category>
            <dc:creator><![CDATA[Dipesh Dulal]]></dc:creator>
            <pubDate>Tue, 17 Nov 2020 14:41:26 GMT</pubDate>
            <atom:updated>2020-11-17T14:41:26.904Z</atom:updated>
        </item>
        <item>
            <title><![CDATA[Dependency Injection with Go-Fx]]></title>
            <description><![CDATA[<div class="medium-feed-item"><p class="medium-feed-image"><a href="https://articles.wesionary.team/dependency-injection-with-go-fx-b698a6585cf0?source=rss-84b5bac24db8------2"><img src="https://cdn-images-1.medium.com/max/1280/1*iriMVOS2I3gEXXeuuC7cMA.png" width="1280"></a></p><p class="medium-feed-snippet">One of the major point in SOLID principle is Dependency Injection where dependencies are injected into one another making them more&#x2026;</p><p class="medium-feed-link"><a href="https://articles.wesionary.team/dependency-injection-with-go-fx-b698a6585cf0?source=rss-84b5bac24db8------2">Continue reading on wesionaryTEAM »</a></p></div>]]></description>
            <link>https://articles.wesionary.team/dependency-injection-with-go-fx-b698a6585cf0?source=rss-84b5bac24db8------2</link>
            <guid isPermaLink="false">https://medium.com/p/b698a6585cf0</guid>
            <category><![CDATA[technology]]></category>
            <category><![CDATA[software-engineering]]></category>
            <category><![CDATA[clean-code]]></category>
            <category><![CDATA[go]]></category>
            <category><![CDATA[programming]]></category>
            <dc:creator><![CDATA[Dipesh Dulal]]></dc:creator>
            <pubDate>Sat, 19 Sep 2020 06:21:42 GMT</pubDate>
            <atom:updated>2020-09-19T06:21:42.617Z</atom:updated>
        </item>
        <item>
            <title><![CDATA[Finite State Machines with Go-lang.]]></title>
            <description><![CDATA[<div class="medium-feed-item"><p class="medium-feed-image"><a href="https://articles.wesionary.team/finite-state-machines-with-go-lang-ccd20e329a7b?source=rss-84b5bac24db8------2"><img src="https://cdn-images-1.medium.com/max/1280/1*ohrrmyXXcig2S-akedCSNA.png" width="1280"></a></p><p class="medium-feed-snippet">In computation theory, the Finite State Machine (FSM) are those machines that can have finite number of states at a given time.They are&#xA0;&#x2026;</p><p class="medium-feed-link"><a href="https://articles.wesionary.team/finite-state-machines-with-go-lang-ccd20e329a7b?source=rss-84b5bac24db8------2">Continue reading on wesionaryTEAM »</a></p></div>]]></description>
            <link>https://articles.wesionary.team/finite-state-machines-with-go-lang-ccd20e329a7b?source=rss-84b5bac24db8------2</link>
            <guid isPermaLink="false">https://medium.com/p/ccd20e329a7b</guid>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[go]]></category>
            <category><![CDATA[software-engineering]]></category>
            <category><![CDATA[finite-state-machine]]></category>
            <category><![CDATA[automata]]></category>
            <dc:creator><![CDATA[Dipesh Dulal]]></dc:creator>
            <pubDate>Tue, 18 Aug 2020 10:59:45 GMT</pubDate>
            <atom:updated>2020-10-09T03:07:38.156Z</atom:updated>
        </item>
        <item>
            <title><![CDATA[Pyramid Chart with Chart.js and React]]></title>
            <description><![CDATA[<div class="medium-feed-item"><p class="medium-feed-image"><a href="https://articles.wesionary.team/pyramid-chart-with-chart-js-and-react-16a1916d5221?source=rss-84b5bac24db8------2"><img src="https://cdn-images-1.medium.com/max/1280/1*7ZmlbFCUkSfD16rhgTOZug.png" width="1280"></a></p><p class="medium-feed-snippet">Chart.JS is a popular java script charting library. Various kinds of Charts can be built with it but when I was searching for building&#x2026;</p><p class="medium-feed-link"><a href="https://articles.wesionary.team/pyramid-chart-with-chart-js-and-react-16a1916d5221?source=rss-84b5bac24db8------2">Continue reading on wesionaryTEAM »</a></p></div>]]></description>
            <link>https://articles.wesionary.team/pyramid-chart-with-chart-js-and-react-16a1916d5221?source=rss-84b5bac24db8------2</link>
            <guid isPermaLink="false">https://medium.com/p/16a1916d5221</guid>
            <category><![CDATA[chartjs]]></category>
            <category><![CDATA[software-engineering]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[react-hook]]></category>
            <category><![CDATA[react]]></category>
            <dc:creator><![CDATA[Dipesh Dulal]]></dc:creator>
            <pubDate>Thu, 06 Aug 2020 07:02:15 GMT</pubDate>
            <atom:updated>2020-08-06T07:15:12.825Z</atom:updated>
        </item>
        <item>
            <title><![CDATA[Server-Sent Events with Go and React]]></title>
            <link>https://articles.wesionary.team/server-sent-events-with-go-and-react-76df101a3efe?source=rss-84b5bac24db8------2</link>
            <guid isPermaLink="false">https://medium.com/p/76df101a3efe</guid>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[react]]></category>
            <category><![CDATA[go]]></category>
            <category><![CDATA[software-engineering]]></category>
            <category><![CDATA[server-sent-events]]></category>
            <dc:creator><![CDATA[Dipesh Dulal]]></dc:creator>
            <pubDate>Sun, 19 Jul 2020 04:31:58 GMT</pubDate>
            <atom:updated>2020-07-19T10:19:41.259Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*0rNi6XT2ffXihxNAhPFXaA.png" /></figure><p>Server-Sent Events (SSE) can be used to send data from server to the client in uni directional manner that will be useful for use cases such as; logging, live feed etc. In this story, we will be using server sent events for receiving logging information from the server and display it in client.</p><p>For this, we will require a publish-subscribe system where any request to stream end point subscribes to event and on any event all the subscribers subscribed to event will get notified.</p><p>To build broadcasting system, we will be using channels for go routines communication. With react, we will construct custom hook that can take in buffered messages with the given length, so let’s start.</p><h4>THE SERVER</h4><p>Let’s create a struct that will store all our clients and notifier channel. The notifier channel will be responsible for delegating events to all clients registered for events.</p><pre>type SSEChannel struct {<br>    Clients  []chan string<br>    Notifier chan string<br>}</pre><pre>var sseChannel SSEChannel</pre><p>The broadcaster function that will be responsible for sending event’s will look like;</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/cbb776241363671b93a54a73f1da4fa9/href">https://medium.com/media/cbb776241363671b93a54a73f1da4fa9/href</a></iframe><p>Here, we are receiving events from sseChannel.Notifier and for all the clients registered in the server send data received from notifier.</p><p>Since our broadcaster is complete, let’s create a handler to receive incoming http requests to /log end point.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/cc17042b77491e06e6463d15e06a5568/href">https://medium.com/media/cc17042b77491e06e6463d15e06a5568/href</a></iframe><p>Notice line #10, here we are sending logging message after creating to Notifier channel which will he handled by our broadcaster running in parallel to the main go routine.</p><p>Let’s create http handler that can handle /sse requests and responds with stream. We will require handler to create a channel and append it to SSEChannel.Clients and listen for messages from the channel.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/0760cc445808459afbf1b7e7a875c4e3/href">https://medium.com/media/0760cc445808459afbf1b7e7a875c4e3/href</a></iframe><p>The from above code we can note that:</p><ul><li>From line #2 to #5, we are setting up headers that will be sent to SSE client. The header Content-Type: text/event-stream is important. This is what says to the client that server supports event stream and don’t close that tcp connection after response is received.</li><li>In line #7, we are casting our HTTPWriter into Flusher which will flush the output. Which means that, after completing preparing for sending to client flushing the writer will send the messages written to writer and prepares it self for another stream which can be seen in flusher.Flush() in line #28.</li><li>As mentioned previously, we are creating channel and appending to the clients list in line #13 and #14.</li><li>From line #20 to #30, we are listening for events that would be sent from our broadcaster go routine defined previously. data:= &lt;-sseChan is used to receive sent log messages which will be sent through our sse stream done in line #27 and after that we flush the writer.</li><li>In line #17, we can note that, data: %v \n\n , this format is compulsory when sending sse and not used just for formatting messages.</li></ul><p>Now the thing that’s left in the server side is to connect all the dots in main() function. i.e</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/a20dfbd347092c0e85d80f9432447e03/href">https://medium.com/media/a20dfbd347092c0e85d80f9432447e03/href</a></iframe><p>The things to note from our implementation is that;</p><ul><li>This is a basic implementation, and doesn’t cover removing closed channels from clients.</li><li>We might use broker pattern for broadcasting system as shown in <a href="https://stackoverflow.com/a/49877632/7448955">this</a> stack-overflow answer.</li></ul><p>Our server side implementation is complete, we can check if this works by going to localhost:5000/sse and can see that the request never gets resolved from loading indicator. Now, if we visit localhost:5000/log we can see that log message has been appeared in tab containing /sse endpoint.</p><h4>THE CLIENT</h4><p>In the client side, let’s create a basic react application with typescript using</p><pre>yarn create react-app frontend --template typescript</pre><p>And create a custom hook useBufferedState that can only store the list of string of length len and if there are more than len the data will be shown in first-in first-out manner.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/fdf864b9499b093b9a0a90e2993cabcb/href">https://medium.com/media/fdf864b9499b093b9a0a90e2993cabcb/href</a></iframe><p>From the implementation, we can note from line #16 to #24 we are creating a custom function that sets the state. The callback in the setBuffer is used to set state to look into the current value of state rather than previous value when used with event handlers in react.</p><p>In our App.tsx , let’s create a global variable es that will store the handle of EventSource .</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/59d80f5629031319412468d534dc0837/href">https://medium.com/media/59d80f5629031319412468d534dc0837/href</a></iframe><ul><li>From line #4 to #12, we are creating EventSource in es global variable. And when message is sent to event stream we are pushing it to our buffered state.</li><li>When close stream button is clicked, es.close() is used to close the steam and push the message to the state.</li><li>The sendRequest message is used for sending random requests to /log endpoint so that event stream message is received.</li></ul><p>The render part of our component will look like;</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/00c6ff1d9005a6d42448ffb8cd1289ae/href">https://medium.com/media/00c6ff1d9005a6d42448ffb8cd1289ae/href</a></iframe><p>Here, we are just attaching our event handlers previously defined. And rendering a pre tag for all the buffer messages. After every thing is complete the output of react code will look like;</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*jmhPwW6v-tx7vJ-h.png" /></figure><p>And wecan send and receive the event streams from go server.</p><p>That’s it. We have created our own event streaming server and a client that can receive events.</p><p>From the Mozilla documentation <a href="https://developer.mozilla.org/en-US/docs/Web/API/Server-sent_events/Using_server-sent_events">here</a>, You should be careful when not using SSE over HTTP/2 because it suffers from limitation of maximum number of open connections which is set to a very low number (6). And this issue won’t be fixed in Chrome and Firebox.</p><p>For full code you can check;</p><p><a href="https://github.com/dipeshdulal/sse-go">dipeshdulal/sse-go</a></p><p>Follow me on GitHub: <a href="https://github.com/dipeshdulal">https://github.com/dipeshdulal</a></p><p>For basic concepts on golang check; <a href="https://github.com/dipeshdulal/learning-golang">https://github.com/dipeshdulal/learning-golang</a></p><p>Have a good day.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=76df101a3efe" width="1" height="1" alt=""><hr><p><a href="https://articles.wesionary.team/server-sent-events-with-go-and-react-76df101a3efe">Server-Sent Events with Go and React</a> was originally published in <a href="https://articles.wesionary.team/">wesionaryTEAM</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>