after opening facebook in browser > i wanted to book mark where in i need to click on menu key (here i needed keyevent) >but due to some port error or session i am unable to figure out. it gave me error
What is your scenario, first of all? In order to sendKeyEvent you need to be within native context. Since you said that you opened facebook in browser, I assume you do some actions within web context…
Use uiautomatorviewer to see, what locators your menu button has.
Example for Chrome 40.x.xxx version on Ruby: within native context call next function: