Java 7 runtime support on App Engine standard was deprecated on December 13, 2017 and will be shut down entirely on January 16, 2019. It is replaced by the Java 8 Runtime Environment.
Samples for the Java 8 runtime can be found here.
This sample demonstrates how to use the Pusher on Google App Engine.
Pusher enables you to create public / private channels with presence information for real time messaging.
This application demonstrates presence channels in Pusher using chat rooms.
All users joining the chat room are authenticated using the /authorize endpoint.
All users currently in the chat room receive updates of users joining / leaving the room.
Java HTTP library is used for publishing messages to the channel
and the JS Websocket library is used for subscribing.
Install the Google Cloud SDK and run:
gcloud init
If this is your first time creating an App engine application:
gcloud app create
- Create a Pusher application and note down the
app_id,app_key,app_secretand the cluster. - Update appengine-web.xml with these credentials.
mvn clean appengine:run
Access http://localhost:8080 via the browser, login and join the chat room. The chat window will contain a link you can use to join the room as a different user in another browser. You should now be able to view both the users within the chat application window and send messages to one another.
- Deploy the application to the project
Access
mvn clean appengine:deployhttps://YOUR_PROJECT_ID.appspot.com