package com.infinite.focus.server.home;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.messaging.simp.SimpMessagingTemplate;
import org.springframework.stereotype.Service;
import org.springframework.web.socket.WebSocketSession;

/*
 * Author: Saboor Salaam
 * 
 */

@Service
public class RealTimeMessageService {
	
	
	private final SimpMessagingTemplate template; 


	@Autowired
	public RealTimeMessageService(SimpMessagingTemplate template) {
		this.template = template;
	}

	
	//Find correct channel for a given instructor and push message through connection
	public void sendMessage(Long instructor_id, String message) {
		
		this.template.convertAndSend("/dispatcher/" + instructor_id, message);	
	}
	

}
