rustam_d Posted October 15, 2020 Share Posted October 15, 2020 I'm from Kazakhstan friends and want to start using uniGui. I pretty good knows what does it means RAD, also I prefer FullStack, that's why I'm interesting on uniGui. At the moment I check trial last version and the last poin to buy uniGui is "JS WebSocket". Please, help me, and I promise I will buy your nice product. Of course I spend much time Google, uniGui forums, youtube ...etc, a week. But nothing is found, maybe I stupid man and you have a chance to prove it. Delphi 10.4, last trial UniGui. I need to get a result from async WebSocket JS cosa I tried indy and SeGeSe ...not connected. I created simple standalone app and wrote this: 1. procedure TMainForm.UniButton1Click(Sender: TObject); begin uniSession.AddJS('GetInfoCall("Hello")'); //don't blame me pls, I know such of this code wrote so bad programmer ) end; initialization RegisterAppFormClass(TMainForm); UniAddJSLibrary('\sample.js',False,[upoFolderFiles,upoPlatformBoth]); //YES I tried customfiles etc... nothing //and include sample.js in not just "files" as all people do, of course in *.exe folder (...\win32\files) end. 2. ---------------sample.js------------------------ var webSocket = new WebSocket('wss://127.0.0.1:45774/'); var callback = null; webSocket.onmessage = function (event) { var result = JSON.parse(event.data); if (result != null) { var rw = { code: result['code'], message: result['message'], responseObject: result['responseObject'], getResult: function () { return this.result; }, getMessage: function () { return this.message; }, getResponseObject: function () { return this.responseObject; }, getCode: function () { return this.code; } }; if (callback != null) { window[callback](rw); } } }; function GetInfo(storageName, keyType, txt, callBack) { var GetInfo = { "name": "kz", "last": "GetInfo", "att": [store] }; callback = callBack; webSocket.send(JSON.stringify(GetInfo)); } function GetInfoBack(result) { if (result['code'] === "500") { return '[500]' + result['message']; } else if (result['code'] === "200") { var res = result['responseObject']; return res; } else { return '[500] unknown result'; } } function GetInfoCall(txt) { GetInfo('Info', "Check", txt, "GetInfoBack"); } ------------------------------------------------------ I need to send a text like this GetInfoCall('Hello') and async to get the result from GetInfoBack. How can I do this? Or I need to use htmlframe ? Quote Link to comment Share on other sites More sharing options...
rustam_d Posted October 19, 2020 Author Share Posted October 19, 2020 Well done...hmm, what about community? Guys, may I ask other experienced developers of the UG (uniGui)? I mean not busy lords of UG. Guys, you fill topic "Are you more than 40 years old", good idea, nice, but it seems better to add a couple of words: "Are you more than 40 years old and still egoist?!". Why? Because of what? We aren't competitors. If we really want to help Delphi survive, we must support each other. Or we think that your opinion could be not clever and has many mistakes...o-o-o common, we aren't young people(alas), we cannot be shy. Quote Link to comment Share on other sites More sharing options...
x11 Posted October 19, 2020 Share Posted October 19, 2020 http://forums.unigui.com/index.php?/topic/12219-simple-websocket-client-server-demo/ unfortunately attached example is for buyers only try to write to one of the authors of the examples, maybe they will agree to send you their examples? Quote Link to comment Share on other sites More sharing options...
rustam_d Posted October 19, 2020 Author Share Posted October 19, 2020 3 hours ago, x11 said: http://forums.unigui.com/index.php?/topic/12219-simple-websocket-client-server-demo/ unfortunately attached example is for buyers only try to write to one of the authors of the examples, maybe they will agree to send you their examples? x11 спасибо большое, я даже перечитал все ваши посты на других форумах, мульти фильтры в гридах и т.п., надо же я ведь тоже четко знаю изнутри dxGrid и cxGrid, вы один из сильных разработчиков. Я не ленивый чтобы сочинять что гуглил, ведь так и было. Стас первый к кому я обращался в личку и он не знал что я не могу качать (но вы в курсе). Отличный парень он ответил в течении часа!!! И все выслал, и поэтому я здесь, т.к. не заработало )). Его коды достаточно своеобразны, не с коробки, но вроде разобрался под себя написал, но сокет молчит, что говорить даже гигант сокетов - SgEgCe тоже не поднимает, а гугл легко (. У меня есть локальная страница html с которой я читаю сокет и получаю данные и вижу пока дорогу в htmlframe, но это рояль в кустах, а пока хочу красивее, через JS так сказать. Но если не дождусь, то придеться заплатить штуку ребятам из стамбула, кстати красивый город, был в командировке 4 раза, таксим, черное море(golden beach), босфор, красота, надо глянуть еще новый аэропорт с метро под босфором. Quote Link to comment Share on other sites More sharing options...
x11 Posted October 19, 2020 Share Posted October 19, 2020 49 minutes ago, rustam_d said: вы один из сильных разработчиков. Спасибо, но это не так Quote Link to comment Share on other sites More sharing options...
x11 Posted October 19, 2020 Share Posted October 19, 2020 Дело в том, что стандартного готового решения в uniGUI для веб-сокетов нету. Я давно пытался изучать те примеры веб-чата и у меня заработало. Вроде бы. Что именно я там делал, я уже не помню. Может ты забыл установить компоненты из папки "components"? Quote Link to comment Share on other sites More sharing options...
x11 Posted October 19, 2020 Share Posted October 19, 2020 вот, прошло меньше получаса и у меня проект взлетел пишу из двух разных браузеров на одном ПК Quote Link to comment Share on other sites More sharing options...
rustam_d Posted October 19, 2020 Author Share Posted October 19, 2020 32 minutes ago, x11 said: Может ты забыл установить компоненты из папки "components"? не понял о какой папке речь ). сокет написали на JS + Java. Мне нужно клиентскую часть прикрутить к стороннему коду, не на Делфи (. Спасибо в любом случае. Quote Link to comment Share on other sites More sharing options...
x11 Posted October 19, 2020 Share Posted October 19, 2020 4 minutes ago, rustam_d said: не понял о какой папке речь я же картинку не зря прикрепил в папке components лежит компонента для использования веб-сокетов в delphi 1 hour ago, rustam_d said: Отличный парень он ответил в течении часа!!! И все выслал, Судя по этому сообщению, я понял, что тебе выслали архив "chat unigui.rar" из той темы, собственно в том архиве и живет папка "components", опять же см. на картинку Quote Link to comment Share on other sites More sharing options...
x11 Posted October 19, 2020 Share Posted October 19, 2020 On 10/15/2020 at 5:09 PM, rustam_d said: procedure TMainForm.UniButton1Click(Sender: TObject); begin uniSession.AddJS('GetInfoCall("Hello")'); //don't blame me pls, I know such of this code wrote so bad programmer ) end; Тебе нужно по кнопке отправить какой-то текст от одного пользователя приложения другому. Или я не верно тебя понял? Quote Link to comment Share on other sites More sharing options...
rustam_d Posted October 19, 2020 Author Share Posted October 19, 2020 2 minutes ago, x11 said: Судя по этому сообщению, я понял, что тебе выслали архив "chat unigui.rar" из той темы, собственно в том архиве и живет папка "components", опять же см. на картинку аа про Стаса, конечно этот UniWebSocket сразу поставил и тестил иначе зачем качать ), результат ...nothing. 3 minutes ago, x11 said: Тебе нужно по кнопке отправить какой-то текст от одного пользователя приложения другому. Или я не верно тебя понял? точно, код JS приложил, котором эта функция. Но я не понимаю логики вызова в UG. Локальная страница Html сразу инициализирует сокет, а на каком этапе в UG не понимаю, в AddJS или в Инициации? Код в инициации твой кстати )), может и его не правильно написал, кто знает. Он сокет работает локально тоже, ему интернет даже не нужен. На вход некий текст и все. Quote Link to comment Share on other sites More sharing options...
rustam_d Posted October 19, 2020 Author Share Posted October 19, 2020 x11 понимаешь разработчики UG везде ссылаются на справку онлайн или uniGUI.chm. Но в последней я в поиске пишу AddJS и ничего нет, где-то по исходникам вижу есть и JSEvent но он пусто. Может я уже разучился искать *.chm ? Всякое бывает после 40 ). Черт с ним с веб-сокетом, мне бы хоть уверенным быть, что я правильно подключаю JS файлы и правильно вызываю функции там, а вдруг они как плагины должны быть оформлены как то специально? Скобки всякие там и прочее колдовство? Да я почти ничего не знаю по UG и у меня в голове щас только 3 типа варианта работы с JS: Sencha от самих компонент(button events etc.), JS plugins, JS и htmlframe. А может я что-то упустил? Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.