Plain WS works, pretty simple:
final WebSocketClient wsc = new WebSocketClient(new URI("ws://echo.websocket.org")) {
@Override
public void onOpen(ServerHandshake handshakedata) {
System.out.println("connected");
}
@Override
| package net.wessendorf.undertow; | |
| import io.undertow.Undertow; | |
| import io.undertow.server.handlers.resource.FileResourceManager; | |
| import org.jboss.resteasy.plugins.server.undertow.UndertowJaxrsServer; | |
| import java.io.File; | |
| import java.util.logging.Logger; | |
| import static io.undertow.Handlers.resource; |
Plain WS works, pretty simple:
final WebSocketClient wsc = new WebSocketClient(new URI("ws://echo.websocket.org")) {
@Override
public void onOpen(ServerHandshake handshakedata) {
System.out.println("connected");
}
@Override
| final WebSocketContainer container = ContainerProvider.getWebSocketContainer(); | |
| final URI securedEndpointURL = new URI("wss://echo.websocket.org"); | |
| container.connectToServer(new Endpoint() { | |
| @Override | |
| public void onOpen(Session session, EndpointConfig config) { | |
| System.out.println("Connected!!!!!"); | |
| } | |
| //}, ClientEndpointConfig.Builder.create().build(), securedEndpointURL); | |
| }, securedEndpointURL); // ah !!! :-) |
| package net.wessendorf.aerogear; | |
| import org.jboss.aerogear.AeroGearCrypto; | |
| import org.jboss.aerogear.crypto.password.DefaultPbkdf2; | |
| import org.jboss.aerogear.crypto.password.Pbkdf2; | |
| import org.junit.Before; | |
| import org.junit.Test; | |
| import java.security.spec.InvalidKeySpecException; |
| // When the program is in the foreground, this callback receives the Payload of the received Push Notification message | |
| - (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo { | |
| // 'userInfo' contains information related to the remote notification. | |
| //NSString *alertValue = [userInfo valueForKeyPath:@"aps.alert"]; | |
| NSLog(@"\nForeground: %@\n", userInfo); | |
| } |
User Foo has these friends:
Now something w/ Foo happened, and all the friends need to be send a mobile push notification.
curl -3 -u "{PushApplicationID}:{MasterSecret}"
-v -H "Accept: application/json" -H "Content-type: application/json"
-X POST
| - (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo fetchCompletionHandler:(void (^)(UIBackgroundFetchResult))completionHandler { | |
| UILocalNotification *notification = [[UILocalNotification alloc]init]; | |
| notification.repeatInterval = NSDayCalendarUnit; | |
| [notification setAlertBody:@"Wake up! You lost a billion in stocks already!"]; | |
| [notification setFireDate:[NSDate dateWithTimeIntervalSinceNow:1]]; | |
| [notification setTimeZone:[NSTimeZone defaultTimeZone]]; | |
| [application setScheduledLocalNotifications:[NSArray arrayWithObject:notification]]; | |
| completionHandler(UIBackgroundFetchResultNewData); |
cordova plugin add org.apache.cordova.camera
simple HTML
<img style="display:none;width:400px;height:400px;" id="bildcken" src="" />
<button onclick="takePhoto();">TAKE IT</button>
And the required JS:
| 17:02:22,634 INFO [org.keycloak.services.managers.AuthenticationManager] (http--127.0.0.1-8080-6) authenticateCookie could not find cookie: KEYCLOAK_ADMIN_CONSOLE_IDENTITY | |
| 17:02:22,657 WARN [org.jboss.resteasy.core.ExceptionHandler] (http--127.0.0.1-8080-6) Failed executing GET /realms/UnifiedPushServer/tokens/login: org.jboss.resteasy.spi.LoggableFailure: Unable to find contextual data of type: org.keycloak.services.ClientConnection | |
| at org.jboss.resteasy.core.ContextParameterInjector$GenericDelegatingProxy.invoke(ContextParameterInjector.java:54) [resteasy-jaxrs-3.0.6.Final.jar:] | |
| at $Proxy98.getRemoteAddr(Unknown Source) at org.keycloak.services.resources.RealmsResource.createAudit(RealmsResource.java:129) [keycloak-services-1.0-beta-1-SNAPSHOT.jar:] | |
| at org.keycloak.services.resources.RealmsResource.getTokenService(RealmsResource.java:71) [keycloak-services-1.0-beta-1-SNAPSHOT.jar:] | |
| at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [rt.jar:1.7.0_09] | |
| at sun.reflect.NativeMethodAccessorImpl |
| <dependency> | |
| <groupId>org.jboss.aerogear</groupId> | |
| <artifactId>unifiedpush-java-client</artifactId> | |
| <version>0.5.0</version> | |
| </dependency> |