1.0.3 • Published 2 years ago

myportal-pusher v1.0.3

Weekly downloads
-
License
ISC
Repository
-
Last release
2 years ago

Installation

$ npm install myportal-pusher

$ yarn add myportal-pusher
import Pusher from "myportal-pusher";

dotenv.config();

const { VUE_APP_PUSHER_APP_ID, VUE_APP_PUSHER_TOKEN } = process.env;

createApp(App)
  .use(Pusher, {
    app_id: VUE_APP_PUSHER_APP_ID,
    token: VUE_APP_PUSHER_TOKEN,
    debug: true,
  })

  .mount("#app");
async  submitMessage() {

	// STORE YOUR MESSAGE
	await  addItem({
		nickname:  this.nickname,
		message:  this.message,
		client_id:  this.$pusher.getClientId(),
	});

	// TRIGGER NEW MESSAGE
	this.$pusher.trigger("chat_update", {
		message:  this.message,
	});
}
async  mounted() {
	this.fetchItems();
	// WATCH UPDATES
	this.$pusher.watch("chat_update", this.fetchItems);
},