[go-nuts] Multipar/related Request in golang

2024-06-17 Thread Afriyie Abraham Kwabena
Hi, AM trying to prepare a multipart/related message which involve JSON data n1n2Request.JsonData and a binary data binaryData to be sent in HTTP request, however, am having issue abou how to set the boundries in the function below. The server is logging "Failed to parse boundary.

[go-nuts] How to design HTTP request between HTTP servers

2021-03-20 Thread Afriyie Abraham Kwabena
Hi, I have been learning Golang for some few months now but still find it difficult to design some applications. I have two HTTP servers A and B and would like to do the following 1. server A send an HTTP PUT request with JSON body to server B. 2. If server B is not available, server A retry

Re: [go-nuts] How to detect HTTP client stop polling at the server side

2020-11-27 Thread Afriyie Abraham Kwabena
Hi, THanks!! BR Abraham On Friday, November 27, 2020 at 11:12:53 AM UTC+2 b.ca...@pobox.com wrote: > On Friday, 27 November 2020 at 06:14:48 UTC Afriyie Abraham Kwabena wrote: > >> What I would like to ask is, using mutex OK and if not the best way of >> solving it, how can

Re: [go-nuts] How to detect HTTP client stop polling at the server side

2020-11-26 Thread Afriyie Abraham Kwabena
+0x11e net/http.(*conn).serve() /usr/local/go/src/net/http/server.go:1834 +0x1d5b Goroutine 18 (running) created at: main.main() /home/xxx/go/src/nfnrfapi/main.go:41 +0x2c6 On Friday, November 27, 2020 at 8:14:48 AM UTC+2 Afriyie Abraham Kwabena wrote: > Hi, > >

Re: [go-nuts] How to detect HTTP client stop polling at the server side

2020-11-26 Thread Afriyie Abraham Kwabena
common.WriteError(response, common.ErrMethodNotAllowed) return } } BR Abraham On Friday, November 27, 2020 at 6:38:52 AM UTC+2 Shulhan wrote: > > > > On 27 Nov 2020, at 07.06, Afriyie Abraham Kwabena > wrote: > > > > Hi, > > > > Am exp

Re: [go-nuts] How to detect HTTP client stop polling at the server side

2020-11-26 Thread Afriyie Abraham Kwabena
if err != nil { config.Logrus.Error(err) } delete(idtime, keyid) } } mu.Unlock() } } BR Abraham On Wednesday, November 18, 2020 at 10:51:49 AM UTC+2 Afriyie Abraham Kwabena wrote: > Hi Sulhan, Anderson, > > Th

Re: [go-nuts] How to detect if transport connection break

2020-11-20 Thread Afriyie Abraham Kwabena
Hi, Yes, that is what intend to implement. Can you help with some information about how I could implement it. If possible some libraries or example code. Abraham On Friday, November 20, 2020 at 1:07:12 PM UTC+2 Afriyie Abraham Kwabena wrote: > Hi, > > Am new to programming and if

Re: [go-nuts] How to detect if transport connection break

2020-11-20 Thread Afriyie Abraham Kwabena
Hi, Am new to programming and if you could explain further what you mean by long lived process. On Friday, November 20, 2020 at 11:41:42 AM UTC+2 amits...@gmail.com wrote: > > > On Fri, 20 Nov 2020, 7:51 pm Afriyie Abraham Kwabena, < > afriyie...@gmail.com> wrote: > >

[go-nuts] How to detect if transport connection break

2020-11-20 Thread Afriyie Abraham Kwabena
Hi, My basic understanding of HTTP protocol is that an HTTP client sent request, get response from the HTTP server and then the connection is closed. My question is how can an HTTP client detect if the underling transport connection break. For example if the HTTP server shutdown, is there a

Re: [go-nuts] How to detect HTTP client stop polling at the server side

2020-11-18 Thread Afriyie Abraham Kwabena
>= 60 { // delete resouce in database after 60 seconds _ = DeleteNFInstance(ctx, keyid) } } mu.Unlock() } } BR Abraham On Tuesday, November 17, 2020 at 9:41:01 PM UTC+2 Shulhan wrote: > > > > On 18 Nov 2020, at 01.06,

Re: [go-nuts] How to detect HTTP client stop polling at the server side

2020-11-17 Thread Afriyie Abraham Kwabena
func main() { > r := NewRouter() > > go worker() > > > fmt.Println("Start listening") > fmt.Println(http.ListenAndServe(":8080", r)) > } > > I appreciate your help but am still not able to it work. > > > On Tuesday, Nov

Re: [go-nuts] How to detect HTTP client stop polling at the server side

2020-11-17 Thread Afriyie Abraham Kwabena
On Tuesday, November 17, 2020 at 3:48:44 PM UTC+2 Shulhan wrote: > Hi Afriyie, > > Looks like you almost there ;) > > > On 17 Nov 2020, at 20.11, Afriyie Abraham Kwabena > wrote: > > > > HI, > > > > This is what I have tried so far but am not able

Re: [go-nuts] How to detect HTTP client stop polling at the server side

2020-11-17 Thread Afriyie Abraham Kwabena
07:12:18 UTC+1 Shulhan wrote: > >> >> >> > On 16 Nov 2020, at 16.24, Afriyie Abraham Kwabena >> wrote: >> > >> > Hi , >> > >> > You are right but am new to programming and currently this what i have >> done. >> &g

Re: [go-nuts] How to detect HTTP client stop polling at the server side

2020-11-16 Thread Afriyie Abraham Kwabena
wrote: > > > On 14 Nov 2020, at 20.06, Afriyie Abraham Kwabena > wrote: > > > > Hi, > > > > My question is about multiple HTTP client polling an HTTP server > randomly with a PATCH request to update a resource at the server running in > front of MongoDB.

[go-nuts] How to detect HTTP client stop polling at the server side

2020-11-14 Thread Afriyie Abraham Kwabena
Hi, My question is about multiple HTTP client polling an HTTP server randomly with a PATCH request to update a resource at the server running in front of MongoDB. The clients poll with their different ids and a valid time in their request. At the server, I can keep their ids and their