How can I integrate PHP API in kaiwa source ?
patelvanita360 opened this issue · 11 comments
Hello, @ForNeVeR @vitalyster , Can you please help me how to integrate PHP API in kaiwa source?
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?
I want to develop Group module using API.
Honestly I have no idea what does it mean. So, what kind of help do you require?
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.
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.
Replace ws with wss in your config.json
thanks @vitalyster , its working now.
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`
Stacktrace could help in this case. Without the stacktrace, I can't figure what's going on.
Okay thanks @vitalyster , i got the solution.