Server-sent events
Server-sent events
Hi Graham, publishing an event to suscribers in a class extending *SsePublisher* is pretty straightforward, you have to do the following:
```java
SimpleEvent event = new SimpleEvent();
event.setId("myId");
event.setType("event1");
event.setPayload("This event occurred at " + LocalTime.now().toString());
this.publishEvent(event);
```
To suscribe to this event, the client app must implement the EventSource class such as:
```javascript
const evtSource = new EventSource("http://localhost:8080/mybotapp/secure/events/event1")
```
> Note: This code is part of the BDK 1.0 that is generated from the bdk-cli tool. This version is not supported anymore by our engineering team but is still available on a as-is basis. The Bot Developer Kit (BDK) has been re-architectured in a 2.0 version where the support of SSE has not been migrated.
Hi Graham, publishing an event to suscribers in a class extending *SsePublisher* is pretty straightforward, you have to do the following:
```
SimpleEvent event = new SimpleEvent();
event.setId("myId");
event.setType("event1");
event.setPayload("This event occurred at " + LocalTime.now().toString());
this.publishEvent(event);
```
To suscribe to this event, the client app must implement the EventSource class such as:
```
const evtSource = new EventSource("http://localhost:8080/mybotapp/secure/events/event1")
```
> Note: This code is part of the BDK 1.0 that is generated from the bdk-cli tool. This version is not supported anymore by our engineering team but is still available on a as-is basis. The Bot Developer Kit (BDK) has been re-architectured in a 2.0 version where the support of SSE has not been migrated.
Server-sent events
Hi Graham, publishing an event to suscribers in a class extending *SsePublisher* is pretty straightforward, you have to do the following:
```
SimpleEvent event = new SimpleEvent();
event.setId("myId");
event.setType("event1");
event.setPayload("This event occurred at " + LocalTime.now().toString());
this.publishEvent(event);
```
To suscribe to this event, the client app must implement the EventSource class such as:
```
const evtSource = new EventSource("http://localhost:8080/mybotapp/secure/events/event1")
```
> Note: This code is part of the BDK 1.0 that is generated from the bdk-cli tool. This version is not supported anymore by our engineering team but is still available on a as-is basis. The Bot Developer Kit (BDK) has been re-architectured in a 2.0 version where the support of SSE has not been migrated.