In order to understand how the Push service in BlackBerry is implemented, I have installed the Push Service SDK and following the Push_Service_SDK-Getting_Started_Guide. Following ths steps thoroughly, on "Registering" myself from the app, I got the following error:
Request to register failed. Caused by java.io.IOException: Network operation [Subscribe] failed. Make sure that Content Provider URL is accesible.
Can anyone guide me through this. When keying in the details, we need to provide the "BPS server URL" and "Push Initiator application URL". I have received the credential details from BlackBerry and it contains PPG Base Url as "cpXXX.pushapi.eval.blackberry.com" where the XX needs to be replaced by the CPID (Content Provider ID). Is this link to be keyed in for "BPS server URL" and "Push Initiator application URL"? I did key in this and received the above error on "Register".
Please guide.
You should have received a mail with your credentials for both server app and blackberry client app. For the client app, they should look like this:
Application ID: <CPID(4 chars)>-<id(35 chars)>
PPG Base URL: http://cpXXX.pushapi.eval.blackberry.com
Push Port: <port(5 chars)>
As you can see, the App id has two parts. The prefix before the dash is your CPID, and the rest is the id. Then we have an URL where we will need to replace the XXX with the CPID (note that the CPID usually is a 4 digit number, so it would have been better if they had used XXXX as placeholder). Finally the port number which has up to 5 digits.
With those params, in your BB app, you would code something like this:
String id = "<your full app id here>";
String url = "http://cp<CPID>.pushapi.eval.blackberry.com"; //Make sure it is http and not https, and check you have replaced <CPID> with the appid prefix.
int port = <port>;
byte serverType = <PushApplicationDescriptor.SERVER_TYPE_BPAS or
PushApplicationDescriptor.SERVER_TYPE_NONE>;
ApplicationDescriptor descriptor = ApplicationDescriptor.currentApplicationDescriptor();
PushApplicationDescriptor pushDescriptor = new PushApplicationDescriptor(id, port, url, serverType, descriptor);
// This is how we would register the client app:
PushApplicationRegistry.registerApplication(pushDescriptor);
After executing that line, if everything is ok (registration needs some time, a few connections are made), you can check the registration status calling PushApplicationRegistry.getStatus or via the onStatusChange callback.
Related
I am looking to retrieve some Solace queue stats e.g. the current messages spooled count out of the maximum limit for us to set a threshold to stop publishing more messages to the queue.
Also, to subscribe to vpn events to track message discard rates.
By the time we receive errors e.g. MaxMsgUsageExceeded/SpoolOverQuota, it will be too late.
I can't seem to find any of these on SolaceSystems.Solclient.Messaging API
https://docs.solace.com/API-Developer-Online-Ref-Documentation/net/html/7f10bcf6-19f4-beff-0768-ced843e35168.htm
Would be great if someone could help
(using C# for this)
To poll for Solace queue stats from your C# application, you could use legacy SEMP over the message bus to make a SEMP request for the details that you want. Semp (Solace Element Management Protocol) is a request/reply protocol that uses an XML schema to identify all managed objects available in a message broker. Applications can use SEMP to manage and monitor a message broker.
To allow for legacy SEMP to be used over the message bus, as opposed to the management interface, it first needs to be enabled on the Solace PubSub+ message broker at the VPN level.
To publish a SEMP request with the Solace .Net Messaging API, perform the following steps:
Create a Session.
Create the message topic. “#SEMP//SHOW”
ITopic topic = ContextFactory.Instance.CreateTopic( “#SEMP/<router name>/SHOW”);
Create a request message and set its Destination to the topic in Step 2:
IMessage requestMsg = ContextFactory.Instance.CreateMessage();
requestMsg.Destination = topic;
Set the SEMP request string as the binary attachment.
string SOLTR_VERSION = "8_4_0" //change to the message-broker's version
string SEMP_SHOW_QUEUE = "<rpc semp-version=\"soltr/" + SOLTR_VERSION +
"<show><queue><name>queueName</name><detail></detail></queue></show></rpc>";
requestMsg.BinaryAttachment = Encoding.UTF8.GetBytes(SEMP_SHOW_QUEUE);
Call the SendRequest(…) method on Session.
IMessage replyMsg;
ReturnCode rc = session.SendRequest(requestMsg, out replyMsg, timeout);
The SEMP response is returned in replyMsg.
Obtain the binary attachment data from the reply message:
replyMsg.BinaryAttachment
The binary attachment contains the SEMP reply for the command topic in the publish request.
The Solace PubSub+ message broker does raise an event when an egress message is discarded. However, it is only sent out approximately once every 60 seconds for the specified client so it is not possible to get these exact rates.
It is possible for your .NET application to subscribe to VPN-level events over the message-bus. To do this, you must first enable the Solace PubSub+ message broker to publish the events. You can then subscribe to the special topic and receive the events as messages.
The topic to subscribe to is:
#LOG/<level>/VPN/<routerName>/<eventName>/<vpnName>
The different levels can use the * wildcard. For example, if you wish to subscribe to all VPN events of all levels for the VPN apple on router QA-NY1, the topic string would be:
#LOG/*/VPN/QA-NY1/*/apple
SEMP (starting in v2) is a RESTful API for configuring, monitoring, and administering a Solace PubSub+ broker.
1-The swapper page link is SEMP V2 API
2-The Swagger metadata definitions URL is located # http://{solace-sever-url}/SEMP/v2/config/spec
3- From Visual studio, add REST API Client
4-In the configuration dialog pass swagger metadata URL (defined at step 2), for code purpose I choose SolaceSemp as input value parameter for client namespace input.
4 Once you click ok, VS will create the client along with the models under SolaceSemp namespace
5 Start using the client as per following
using SolaceSemp;
using Microsoft.Rest;
var credentials = new BasicAuthenticationCredentials();
credentials.UserName = "place user name";
credentials.Password = "place password";
using (var client = new SolaceSempClient(credentials))
{
var model = client.GetAboutApi();
}
I am trying to generate access token for twilio chat but got this error:I have been trying to figure out where the error is coming from but can't get it figured out. I will really appreciate your help. Thanks
E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.zihron.projectmanagementapp, PID: 16355
java.lang.Error: javax.xml.datatype.DatatypeConfigurationException: Provider org.apache.xerces.jaxp.datatype.DatatypeFactoryImpl not found
at javax.xml.bind.DatatypeConverterImpl.<clinit>(DatatypeConverterImpl.java:744)
at javax.xml.bind.DatatypeConverter.<clinit>(DatatypeConverter.java:78)
at javax.xml.bind.DatatypeConverter.printBase64Binary(DatatypeConverter.java:547)
at io.jsonwebtoken.impl.Base64Codec.encode(Base64Codec.java:24)
at io.jsonwebtoken.impl.Base64UrlCodec.encode(Base64UrlCodec.java:22)
at
io.jsonwebtoken.impl.AbstractTextCodec.encode(AbstractTextCodec.java:31)
at io.jsonwebtoken.impl.DefaultJwtBuilder.base64UrlEncode(DefaultJwtBuilder.java:314)
at io.jsonwebtoken.impl.DefaultJwtBuilder.compact(DefaultJwtBuilder.java:282)
at com.twilio.jwt.Jwt.toJwt(Jwt.java:100)
at ZihronChatApp.token.TokenGenerator.getToken(TokenGenerator.java:34)
at com.zihron.projectmanagementapp.ChatActivity.onCreateView(ChatActivity.java:43)
I have my details below:
public AccessToken getToken() {
// Required for all types of tokens
String twilioAccountSid ="AC601f2c7***7ed***640***264c***d0d";
String twilioApiKey = "SK684***dda***c81****6c4a****093**";
String twilioApiSecret ="96****dbc06****b74d50***b9***3*4";
String serviceSid="IS***a29****e24****5d****4b20**3e*";
String identity = "joshua.hamilton#gmail.com";
ChatGrant grant = new ChatGrant();
grant.setServiceSid(serviceSid);
AccessToken token = new AccessToken.Builder(twilioAccountSid,
twilioApiKey, twilioApiSecret)
.identity(identity).grant(grant).build();
Log.e("++==--",""+token.toJwt());
//.identity(identity).grant(grant);
return token;
}
Twilio developer evangelist here.
The Twilio Java library is not intended for use within Android projects.
The issue here is that you should not be storing your credentials within your application. A malicious user could decompile your application, take your credentials and abuse them.
Instead, you should create a server (or use some sort of serverless environment, like Twilio Functions) that can run this code and return the token. You should then make an HTTP request from your Android application to fetch that token. Check out the Twilio Programmable Chat Android Quickstart to see how it's done there.
I am passing authentication token parameter like below...
socket = SocketIOClient(socketURL: URL(string:"http://localhost:3001")!, config: [.log(true), .forcePolling(true),.connectParams(["Authorisation": kToken])])
But it always gives an error....
LOG SocketParser: Decoded packet as: SocketPacket {type: 2; data: [login_ack, {
message = "InValid Token";
result = "";
status = error;
}]; id: -1; placeholders: -1; nsp: /}
As I think that I am missing some thing to establish authenticated socket connection. So, please guide me where I am lacking.
I have resolved it by my self!
It was the issue from back end team. They were put some dependencies with the socket call back sender device information details which they are taking from the socket call backs. And the actual problem was ,all the devices and computers were providing their device details but iOS was not giving it from their end with their security protection.So,their validity condition were not satisfying for iOS socket call backs.
Backend team handled this situation by putting "Other" device type checking at their end.
I have a bunch of temperature data my Arduino monitors that I want to put into a Google Fusion table. Fusion tables require OAuth for record inserts which the Arduino can't handle (I don't think), I want to create a little app Google's App Engine that will receive the data from the Arduino, then this app will authenticate with the Fusion table and insert a record. Each record would have about 65 fields. I don't know how to do the app on Google App Engine yet, but I'll figure that our separately. What I'd like to know is the pros and cons of sending the data to the app using a GET request or a POST request from my Arduino. For this scenario, is one a better choice then the other?
You will need to use an HTTP POST request if you are wanting to send data from the Arduino.
The difference between the two is that GET is for requesting data from the server, while POST is for sending data to the server.
Here is a link for information about HTTP Message Types:
http://www.w3.org/Protocols/rfc2616/rfc2616-sec4.html#sec4
Now for the Arduino code, you need to do the following to send the POST request using the GSM Shield.
//First, establish a connection to the cell tower via GSM
String PIN = "123456"; //The PIN of your SIM card
gsmAccess.begin(PIN);
//Next, connect to your service provider's GPRS network (internet access)
String GPRS_APN = "The APN of your provider";
String GPRS_LOGIN = "Your login name";
String GPRS_PASSWORD = "Your password";
gprs.attachGPRS(GPRS_APN, GPRS_LOGIN, GPRS_PASSWORD);
//Now you need to connect a client to your GAE web server on port 80
client.connect("ServerName", 80);
//Now send the properly-formed HTTP POST request
String message = "The message body of the request, the data you want to send";
client.print("POST ");
client.print("/yourPathToDesiredPage");
client.println(" HTTP/1.1");
client.print("Host: ");
client.println("ServerName");
client.println("Content-Type: text/plain");
client.print("Content-Length: ");
client.println(message.length());
client.println();
client.println(message);
client.endWrite();
1> Just want to understand how SignalR 1.x functions in a particular scenario
Lets say we have a 10 clients connected to Hub and one of the connected clients say client-1 performs a postback so OnDisconnected is called than OnConnected is called right ?
What happens if during this phase if client-2 try's to send message to client-1 exactly between the said scenario ie (msg is sent after client-1 is disconnected and before connected again )will client-1 miss the message or there's internal mechanism which makes sure client-1 does not miss the message sent by client-2
2> Second query I have is that I'm trying to pass a querystring using following code
var chat = $.connection.myHub;
$.connection.myHub.qs = { "token": "hello" };
but not able to retrieve it on the server side from the Context object
using
Context.QueryString.AllKeys
I even tried
var chat = $.connection.myHub;
$.connection.myHub.qs = "token=hello" ;
But it does not work ie when I check the keys, token is not present in AllKeys
Will appreciate if someone just help me out.
1: If a postback occurs a client will disconnect and then connect. However, when the client performs a connect again it will have a different Connection Id than it had prior to the postback. Therefore, any message sent to the old connection id will be missed because when the users browser connects again it will be known as a different client.
2: You're trying to set the query string on the hub proxy, not the connection. What you should be doing is:
$.connection.hub.qs = { foo: "bar" };