This commit is contained in:
parent
f80411bf21
commit
6867086c4f
30
client/helpers/networkHelper.go
Normal file
30
client/helpers/networkHelper.go
Normal file
@ -0,0 +1,30 @@
|
||||
package helpers
|
||||
|
||||
import (
|
||||
"forge.redroom.link/yves/meowlib"
|
||||
"forge.redroom.link/yves/meowlib/client"
|
||||
)
|
||||
|
||||
func HttpSendMessage(serverUid string, message []byte) ([]byte, error) {
|
||||
id := client.GetConfig().GetIdentity()
|
||||
srv, err := id.MessageServers.LoadServer(serverUid)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
// gettig server Public key if missing
|
||||
if srv.PublicKey == "" {
|
||||
srvdata, err := meowlib.HttpGetId(srv.Url)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
//print(srvdata["publicKey"])
|
||||
srv.PublicKey = srvdata["publicKey"]
|
||||
id.MessageServers.StoreServer(srv)
|
||||
}
|
||||
|
||||
response, err := meowlib.HttpPostMessage(srv.Url, message)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return response, nil
|
||||
}
|
@ -8,5 +8,5 @@ NativeLib -> Bastet : invitationGetMessage
|
||||
Bastet -> Server : send accept message
|
||||
Server -> Redis : store accept message
|
||||
Server -> Bastet : accept message ok
|
||||
Bastet -> User : msg sent
|
||||
Bastet -> User : accept msg sent
|
||||
@enduml
|
@ -5,5 +5,5 @@ NativeLib -> Server : get new messages
|
||||
Server -> NativeLib : send invitation message
|
||||
Server -> Redis : store accept message
|
||||
Server -> Bastet : accept message ok
|
||||
Bastet -> User : msg sent
|
||||
Bastet -> User : invitation sent is accepted
|
||||
@enduml
|
Loading…
Reference in New Issue
Block a user