How to create permanent group using ejabber xmpp in iOS - ios

Note:- Before down grade question read description.
We are implement ejabberd for chat application personal chat working fine with all functionality. now we need to create permanent group using ejabberd MUC/SUB service.
We read https://docs.ejabberd.im/developer/xmpp-clients-bots/proposed-extensions/muc-sub/ documents.
Now my question is that how we can send all this IQ using iOS if you guys have any demo or sample code then share here.
We also try with PHP rest API but not getting any presence or ping into iOS application.

Ejabberd never remember groupJID which is created by us. but you can achieve with the help of web service by storing group info while creating group and every-time fetch group info from server and join manually,
let xmppRoom = self.getRoomObject(roomJid: roomID.appending(GroupConfernce))
let history = DDXMLElement.element(withName: "history") as! DDXMLElement
history.addAttribute(withName: "maxstanzas", stringValue: "10")
xmppRoom.addDelegate(self.appDelegate, delegateQueue: DispatchQueue.main)
xmppRoom.join(usingNickname: self.appDelegate.xmppStream?.myJID.user, history: history)
otherwise you can use MongooseIM Server, it has capability to remember group info and no need of any manual process.
check below link
https://github.com/esl/MongooseIM

Related

Can "presence_query" be used in the new slack app?

I want to query the presence of users in a Slack workspace.
Using the old (classic) app, I can do it using presence_query via Slack RTM.
However, RTM requires depracted bot scopes (and the old classic app).
Can I use (and how) presence_query with the new slack app (I'm using python)?
This is my current implementation (using the old classic app):
from slack_sdk.rtm_v2 import RTMClient
rtm_client = RTMClient(token='SLACK_BOT_TOKEN')
#rtm_client.on("presence_change")
def receive_presence_changes(client:RTMClient, event:dict):
print(event)
rtm_client.connect()
rtm_client.send(
payload={
"type" : "presence_query",
'ids' : ids_list,
}
)
No, there are currently no ways to subscribe to presence-oriented events on the Events API or via Socket Mode. The legacy RTM API is the only avenue still available.

HKHealthStore request authorization once again

In the previous version of my iOS app I was asking users to grant access to write Dietary Energy in Health app (see the code bellow):
let typesToWrite: Set<HKSampleType> = [HKQuantityType.quantityType(forIdentifier: HKQuantityTypeIdentifier.dietaryEnergyConsumed)!]
healthStore.requestAuthorization(toShare: typesToWrite , read: nil) { (success, error) in
//...
}
And many users gave access to write Energy Data to Health app.
Now, I want to make an update for my app, and I need to add another sample type: Dietary Sugar, and I would like to show again the Health access window, in order to old users gave access to the Dietary Sugar too. The problem is that this window is not showing anymore for old users. How can I force a request authorization for new added type in update version of the app? Thank you.

Is it possible to make an uber-like map tracking using PubNub?

I have been trying to make a web app that has a certain feature like uber where users can see other users on a map. I read about pubNub (https://www.pubnub.com/) and I saw they have a tutorial that allows you to track movements on a map https://www.pubnub.com/tutorials/javascript/mapping-javascript-tracking/.
They also provide a tool called presence (https://www.pubnub.com/products/presence/) which allows you to see if users have joined your web session or not. I would like to, with presence, to show on a map if people have joined the session or left the session. If they are on the map, I would like the movements to be updated as well.
I am just wondering if someone has used pubNub before to achieve something similar and if so how to go about it?
Clone Uber with PubNub and EON Maps
https://github.com/pubnub/pubnUber - GitHub Repository
Today we're going to use Phonegap and PubNub to create a simple taxi hailing app. What we'll walk through today is the same technology stack used by Uber, Gett, and other taxi hailing apps. They all work in a similar fashion.
Getting started
Install phonegap on the CLI.
Clone this repository locally.
The repo contains two directories /rider and /driver. We're going to start with /driver.
Set Up PubNub
First, we need to set up PubNub. the PUBNUB variables comes for free from the EON library. The publish_key and subscribe_key settings come from your PubNub account.
var channel = "pubnub-taxi-app";
var pubnub = PUBNUB.init({
publish_key: 'demo',
subscribe_key: 'demo'
});
The pubnub plugs the same pubnub variable we configured in the first step into EON. This lets us use our own PubNub keys within EON.
Our Mapbox configuration is set and we're ready to send some
Publish messages to the channel
Define our PubNub channel.
Subscribe.
pubnub.subscribe({
channel: channel,
message: function(message,env,channel){
if(message == 'hail') {
var pickup = confirm("Someone requested a ride!", "Accept");
if(pickup) {
pubnub.publish({
channel: channel,
message: 'pickup'
});
}
}
}
});
And here is the hail() function.
var hail = function(argument) {
pubnub.publish({
channel: channel,
message: 'hail'
});
alert('Waiting for driver...');
};

How do i setup a connection between the iOS Devince and server to pass data

I really have no idea about where to start.
I need a place to store datas, coming from my application user's but how do i do?
The answer is server.
I have never had any experience with server side of any application, but now i do but i got no idea about where to start.
What do i need?Where should i start?I need to get data from the user and store them, i ll be sending notification (push) to the user based on the data i got.
for the moderators; please don't take this question as too broad.I really have no idea to begin with.
You have 2 ways of doing this.
Online server/webhost.
You will first need to equip yourself with an online server to serve the purpose.
Secondly, you will have to take to make a MYSQL database on the online website/server host and create a PHP file. After doing this, you should pass the parameters/entered values in your IOS application to this PHP file on the server. The PHP file then runs to add these entries to the database.
You can then access these entries from the database from another PHP file which the other/same program connects to.
Dedicated home server
By this I mean, the computer at home is dedicated to serve the requests made from your IOS applications. Although the implementations remain the same, in this case you can use sockets to let the client application connect to your computer using your computer's public IP address. You can have a dedicated server application running on your PC to receive incoming requests and connections and create an instance of thread for each of them. And also, you would need a local database just like the previous method to store the data in case you need it for further use, else you could just parse the request and send a reply/message accordingly from the home server application.
Hope this helps.
Man my advice for you would be to check Parse. This company was bought by Facebook and it's focused on create a server side integrated with your app using less effort(don't need to any web language to create a server). Check this out https://parse.com/
P.S.: There is a new API for iOS 8 called CloudKit. This might help you as well.
My personal favorite is Parse. It's free to use, and they have great iOS documentation. There's only a few steps to use it.
Create an account
Go to account keys once you have an account and get ApplicationID and Client Key
Download the iOS SDK
Add a ton of frameworks to your XCode project (including the Parse.framework file you just got)
AudioToolbox.framework
CFNetwork.framework
CoreGraphics.framework
CoreLocation.framework
libz.1.1.3.dylib
MobileCoreServices.framework
QuartzCore.framework
Security.framework
StoreKit.framework
SystemConfiguration.framework
Register yourself for Parse [Parse setApplicationId:#"MY_APPLICATION_ID" clientKey:#"MY_CLIENT_KEY"];
Create and try to save an object!
[Parse setApplicationId:#"MY_APPLICATION_ID"
clientKey:#"MY_CLIENT_KEY"];
PFObject *chicken = [PFObject objectWithClassName:#"Chicken"];
chicken[#"eggsLaid"] = #(23);
chicken[#"name"] = #"Sally";
[chicken saveInBackgroundWithBlock:^(BOOL succeeded, NSError *error) {
if (succeeded) {
NSLog(#"Successfuly saved chicken: %#", chicken);
} else {
NSLog(#"There was an error: %#", error);
}
}];
Finally, go to your dashboard and add the class Chicken, and the columns eggsLaid (as a number) and name (as a string).

Interacting my lua app (LuaSocket) with my socket.io chat example server

I am writing an app for Corona SDK (Using LuaSocket) to be able to subscribe and post messages to the example chat server that runs in socket.io (using gevent-websocket 0.9).
I have checked that chat.js on the server interacts with ther server like this:
To subscribe to a room:
socket.subscribe('room-2000')
Or interacting with the chat room:
socket.send({room: 'room-2000', action: 'start', name: 'John'})
socket.send({room: 'room-2000', action: 'message', message: 'hi there!)});
etc..
Full js client script.
But I don't find a way to make an app for Corona SDK to interact with a channel. I managed to connect to the server with:
socket.connect( my_ip, my_port)
But cannot find a way to subscribe or post/receive messages, can someone give me a clue? Will be highly appreciate it.
AFAIK, you need to do a WebSocket handshake. Read the WebSocket specifiation.
Otherwise, I can recommend you this Publish/Subscribe library for CoronaSDK/Nodejs
https://github.com/Overtorment/NoobHub

Resources