ForNeVeR / Kaiwa

A modern XMPP Web client
MIT License
74 stars 13 forks source link

How can I integrate PHP API in kaiwa source ? #237

Closed patelvanita360 closed 6 years ago

patelvanita360 commented 6 years ago

Hello, @ForNeVeR @vitalyster , Can you please help me how to integrate PHP API in kaiwa source?

ForNeVeR commented 6 years ago

Kaiwa is designed to be a simple JS application that you could put under any server and it should just work. I can't see what PHP support we would need. What do you want?

patelvanita360 commented 6 years ago

I want to develop Group module using API.

ForNeVeR commented 6 years ago

Honestly I have no idea what does it mean. So, what kind of help do you require?

patelvanita360 commented 6 years ago

Okay. In short i want to integrate api. If you have any idea then please help me how can i do it.

On Sat, Oct 13, 2018, 3:40 PM Friedrich von Never notifications@github.com wrote:

Kaiwa is designed to be a simple JS application that you could put under any server and it should just work. I can't see what PHP support we would need. What do you want?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/ForNeVeR/Kaiwa/issues/237#issuecomment-429528172, or mute the thread https://github.com/notifications/unsubscribe-auth/Aje4ziRzOWWR6PeKndH6ag_swpVSduAkks5ukbwSgaJpZM4XaduY .

ForNeVeR commented 6 years ago

Well, I positively have no idea what do you mean by "integrate api". If you want to publish Kaiwa on your web server — then you just go ahead and publish it on your web server.

patelvanita360 commented 6 years ago

okay. i am facing one issue when publish kaiwa on web server.

Following error i am getting : The page at 'https://domainname/' was loaded over HTTPS, but attempted to connect to the insecure WebSocket endpoint 'ws://chatserverdomain/ws/'. This request has been blocked; this endpoint must be available over WSS.

and

Uncaught DOMException: Failed to construct 'WebSocket': An insecure WebSocket connection may not be initiated from a page loaded over HTTPS.

vitalyster commented 6 years ago

Replace ws with wss in your config.json

patelvanita360 commented 6 years ago

thanks @vitalyster , its working now.

patelvanita360 commented 6 years ago

Well, I positively have no idea what do you mean by "integrate api". If you want to publish Kaiwa on your web server — then you just go ahead and publish it on your web server.

For API let me give brief detail if you can help me. In kaiwa group creation is not working properly so i thought to call external api for group.

I have integrated it like this when create group in /src/js/views/main.js file.

var express = require('express');
var router = express.Router();
var request = require('request');

router.get('/', function(req, res, next) {
  request({
    uri: 'https://webdomain/api/group', // here i have created api in php to create group 
    qs: {
      id:1473, 
       action:"create", 
       token:"S0FPcTVWemIzdjdzQUozYWp3Rk1pUT09",
       jid:"test1@conference.chatdomain",
       title:"test1",
       description:"abc",
       icon:"jfhdgjkfhuuh",
       contacts:"[{\"memberid\":\"1\",\"role\":\"admin\"},{\"memberid\":\"2\",\"role\":\"member\"}]"
    },
    function(error, response, body) {
      if (!error && response.statusCode === 200) {
        console.log(body)
      }
    }
  });
});
module.exports = router;

can you please help me to find whats wrong in it ? got following error Uncaught TypeError: Cannot read property 'prototype' of undefined`

ForNeVeR commented 6 years ago

Stacktrace could help in this case. Without the stacktrace, I can't figure what's going on.

patelvanita360 commented 6 years ago

Okay thanks @vitalyster , i got the solution.