| Welcome, Guest |
You have to register before you can post on our site.
|
| Online Users |
There are currently 1453 online users. » 2 Member(s) | 1446 Guest(s) Applebot, Bing, Facebook, Google, Yandex, iwinclubplus1, taivideodouyinvn
|
|
|
| IdHTTP Post problem |
|
Posted by: BartKindt - 07-11-2019, 10:46 PM - Forum: Indy
- Replies (1)
|
 |
I am trying to post weather data to the OpenWeatherMap API server.
They use a RESTful server (API 3.0).
The documentation on this is totally incomplete.
Using a third-party program called 'ARC' and a lot of research, I discovered that in addition to adding the KEY to the URL, it is also required that *before* the HTTP Request the same KEY is send, which in this ARC program is called an 'Action', with a 'Name' and a 'value'.
In another application reference on the Internet the same name+value where added in what was called the 'Params' of this application.
The only Params I have been able to find in the IdHTTP Client is here:
IdHTTP1.Request.Authentication.Params.AddValue('appid',APIKey);
But this cannot be done because the 'Authentication' is not created.
And when I try to create it manually, I get a
[dcc32 Warning] Unit1.pas(224): W1020 Constructing instance of 'TIdAuthentication' containing abstract method 'TIdAuthentication.DoNext'
I am not even sure if this is the right location for this 'name' + 'Key'.
The OpenWeatherMap API does not do any negotiation; When the HTTP Post is not excactly correct, it just gives a '400' and disconnects.
OnAuthorisation and OnSelectAuthorisation are never called.
How am I to add these values to the HTTP Post, *before* the body containing JSON data is send?
|
|
|
| Advice about where put a code to websocket |
|
Posted by: cprmlao@hotmail.com - 07-10-2019, 03:08 PM - Forum: IntraWeb General Discussion
- Replies (5)
|
 |
Hi,
I have many iw forms, all inherited from a standard iwform(TIWFormStd).
I have a MasterTemplate html to all my IWForms.
I have my websocket server component in servercontroller module(I don´t know if this is the better place)
I need the websocket client available in all forms, because my app has a chat to users.
In that MasterTemplate, I have the next script code to connect to websocket server:
Code: <script>
function wschat()
{
if (!ws || ws.state()!='open'){
ws = new sgcWebSocket('ws://127.0.0.1:5414/auth/url/admin/1234');
}
ws.on('open', function(evt){
console.log(ws.state())
});
ws.on('message', function(evt){
console.log(evt.message)
})
}
wschat()
</script>
My problem is that when I open a new iwform, I allways release the old iwform. As the old form is released, the websocket connection in the frontend is destroyed as well and recreated when the new IWForm is active.
I´d like to know some suggestions about where I can put the websocket client code to avoid it.
Regards, Luiz
|
|
|
| IdDateTimeStamp gives strange result |
|
Posted by: jollytall - 07-09-2019, 10:20 AM - Forum: Indy
- Replies (1)
|
 |
I might have missed something, but tried a very simple code:
procedure TForm1.Button1Click(Sender: TObject);
begin
IdDateTimeStamp1.SetFromTDateTime(Now);
memo1.lines.add(DateTimeToStr(Now));
memo1.lines.add(IdDateTimeStamp1.AsISO8601Calendar);
end;
and got the result:
9-7-19 12:06:56
2020-8-10T12:06:56,
i.e. the Year, the Month and the Day are all +1 compared to the real one. I tried other dates and always this offset.
Any idea?
I use Debian 9, Gnome 3.22.2, Lazarus 2.0.2., FPC 3.0.4, on 64 bit.
|
|
|
| on resize for regions? |
|
Posted by: pete@pdmagic.com - 07-07-2019, 09:40 PM - Forum: IntraWeb General Discussion
- Replies (2)
|
 |
Standard HTML+JS only provides resize events for windows and frames. However Intraweb also resizes controls using the align functionality. (e.g. when a splitter is used)
There are a couple of places where I've embedded content that needs to be notified of resize so they can redraw themselves. I've got the following code in one such place:
Code: window.resize(function(){
CurDgm.PanZoom.resize();
CurDgm.PanZoom.fit();
CurDgm.PanZoom.center();
});
That code works as expected when the browser is resized. However, when a splitter is used that causes the containing region to change size, that function will not be called.
Is there an IW event handler I can hook to to call this code when a region changes size?
Thanks!
|
|
|
|